How to use @formiz/core - 10 common examples

To help you get started, we’ve selected a few @formiz/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivan-dalmet / formiz / examples / src / pages / LotOfFields.js View on Github external
export const LotOfFields = () => {
  const form = useForm();

  const handleSubmit = (values) => {
    // eslint-disable-next-line no-alert
    alert(JSON.stringify(values, null, 2));
    form.invalidateFields({
      'name-0': 'You can display an error after an API call',
    });
    const stepWithError = form.getFieldStepName('name-0');
    form.goToStep(stepWithError);
  };

  return (
github ivan-dalmet / formiz / examples / src / pages / Wizard.js View on Github external
export const Wizard = () => {
  const form = useForm();

  const handleSubmit = (values) => {
    // eslint-disable-next-line no-alert
    alert(JSON.stringify(values, null, 2));
    form.invalidateFields({
      name: 'You can display an error after an API call',
    });
    const stepWithError = form.getFieldStepName('name');
    form.goToStep(stepWithError);
  };

  return (
github ivan-dalmet / formiz / examples / src / pages / UseCase1 / index.js View on Github external
export const UseCase1 = () => {
  const form = useForm();

  const handleSubmit = (values) => {
    // eslint-disable-next-line no-alert
    alert(JSON.stringify(values, null, 2));
    form.invalidateFields({
      'docker.image': 'You can display an error after an API call',
    });
    const stepWithError = form.getFieldStepName('docker.image');
    form.goToStep(stepWithError);
  };

  return (
github ivan-dalmet / formiz / examples / src / pages / Repeater.js View on Github external
export const Repeater = () => {
  const form = useForm();
  const [collection, setCollection] = useState(defaultCollection);

  useEffect(() => {
    setCollection(defaultCollection);
  }, [form.resetKey]);

  const handleSubmit = (values) => {
    // eslint-disable-next-line no-alert
    alert(JSON.stringify(values, null, 2));
  };

  const addItem = () => {
    setCollection(c => [
      ...c,
      {
        id: uuidv4(),
github ivan-dalmet / formiz / examples / src / pages / AutoForm.js View on Github external
export const AutoForm = () => {
  const form = useForm();

  const handleSubmit = (values) => {
    // eslint-disable-next-line no-alert
    alert(JSON.stringify(values, null, 2));
    form.invalidateFields({
      name: 'You can display an error after an API call',
    });
  };

  return (
github ivan-dalmet / formiz / examples / src / pages / UseCase1 / ExposedPorts.js View on Github external
export const ExposedPorts = () => {
  const form = useForm();
  const isDarkTheme = useDarkTheme();
  const [exposedPorts, setExposedPorts] = useState([]);

  useEffect(() => {
    setExposedPorts([]);
  }, [form.resetKey]);

  const addItem = () => {
    setExposedPorts(s => [
      ...s,
      {
        id: uuidv4(),
      },
    ]);
  };
github ivan-dalmet / formiz / examples / src / components / MultiStepsLayout.js View on Github external
export const MultiStepsLayout = ({
  form: externalForm,
  children,
  submitLabel = 'Submit',
  ...props
}) => {
  const internalForm = useForm();
  const form = externalForm || internalForm;
  const hasSteps = !!form.steps.length;

  return (
    
      
        <form novalidate="">
          {children}

          {hasSteps &amp;&amp; (
            
              {!form.isFirstStep &amp;&amp; (
                </form>
github ivan-dalmet / formiz / examples / src / components / PageHeader.js View on Github external
export const PageHeader = ({ children, onReset, githubPath }) =&gt; {
  const form = useForm();

  return (
    
      
        {children}
        <button> {
            form.reset();
            onReset();
          }}
          ml="auto"
          size="sm"
        &gt;
          Reset form
        </button>
github ivan-dalmet / formiz / examples / src / components / Debug.js View on Github external
export const Debug = () =&gt; {
  const form = useForm();

  return (
    
      
        # Debug - Form values
      
      {JSON.stringify(form.values, null, 2)}
    
  );
};
github ivan-dalmet / formiz / examples / src / pages / UseCase1 / DockerImage.js View on Github external
export const DockerImage = () =&gt; {
  const [isPrivate, setIsPrivate] = useState(false);
  const form = useForm();

  useEffect(() =&gt; {
    setIsPrivate(false);
  }, [form.resetKey]);

  return (
    
      
            Use
            {' '}

@formiz/core

Core package for the [Formiz](https://formiz-react.com) library.

MIT
Latest version published 6 months ago

Package Health Score

62 / 100
Full package analysis

Popular @formiz/core functions

Similar packages