Git Product home page Git Product logo

formik-wizard-form's Introduction

Formik Wizard Form

npm type definitions npm compressed size build e2e tests GitHub

Getting Started

Formik wizard form is a library which lets you build multistep form wizards in React with ease. It has been written over the famous form library formik and provides the enhanced versions of formik's <Formik /> and useFormik hook. Formik wizard form requires few additional props along with <Formik /> original props as well as adds some properties to the render props object.

Apart from that, the library is style or css framework agnostic and leaves the rendering part completely up to you. It just provides render props and you build your UI out of them.

For more information on usage, please refer to the How To Use and Examples section.

How To Install

Install the package from npm or yarn registry.

Install From Yarn

yarn add formik-wizard-form

Install From NPM

npm install formik-wizard-form --save

How To Use?

Formik wizard form exports two components <FormWizard /> and useFormikWizard similar to Formik's <Formik /> and useFormik hook and their original props have been left untouched. Rather they require you to provide few additional props to create a form wizard.

import { FormikWizard, useFormikWizard } from 'formik-wizard-form';

Visit formikwizard.manishjangir.com for docs and examples!

Based On

Formik

Maintainers

Manish Jangir

formik-wizard-form's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar lokeshpathrabe avatar mjangir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

formik-wizard-form's Issues

Passing props to Form component

I think it would be usefull to add ability to passing props to Form component.

For example I need to prevent form submitting on enter, so I want to add onKeyDown handler on Form

<Form onKeyDown={ e => { if ((e.key === 'Enter') && (e.target.tagName !== 'BUTTON' || e.target.type !== 'submit')) { e.preventDefault() } }}>

Example of integrating 3rd Party component

Hi mjangir,
Thanks for sharing your code. Do you by chance have an example of using
a 3rd Party control like "react-select" in your wizard that maintains state and onchange events as you use the navigation buttons to go back and forth in the wizard. Thanks so much for the reply.

Project Abandoned?

Love the project. but will this be maintained in the future? Don't see any updates for the last 2 years.

How to validate step with field array?

Yup scheme example:

someFieldsArray: yup.array().of(yup.object().shape({
  fieldName: yup.string().required(),
  anotherFieldName: yup.string().requried(),
})),

stepValidation file ->
const stepValidator = ({errors}) => ...???

Navigating between steps

This looks awesome, especially the ability to validate each step.

One question, the browser's forward and back buttons are disabled in your example, but could they be used to navigate between steps? That's what I like about this solution, the forward and back buttons still work as expected, and there is a Prompt component that prevents data loss if the user accidentally tries to navigate away from the form (which could potentially be done through site navigation or a bookmark even if the forward and back buttons are disabled).

Navigating to the previous step should trigger a validation

Bug report

Current Behavior

If a form step is invalid, the next button will be disabled after clicking on the previous button
ODJeBPYcTd

Expected behavior

The valid step should be seen as valid and the next button should be enabled

Reproducible example

The materialui sample: https://codesandbox.io/s/material-formik-wizard-form-h37hs?from-embed

  • fill the 1st step with valid fields
  • click on next
  • click on next. the step is invalid, so it disables the next button
  • click on prev. the first step is valid, so the next button should be enabled again.

Suggested solution(s)

force a validation when going back ?

Additional context

Your environment

Software Version(s)
Formik Wizard Form 2.0.1
Formik 2.2.9
React 17.0.2
TypeScript 4.1.2
Browser chrome 95
npm/Yarn yarn 1.22.11
Operating System win 10

npm package fails , but src files are ok

I am facing some weird bugs with this package.
if I use npm package , I got this error :

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `FormikWizardProvider`.

but if I use files from ./src (like example) the error will disappear.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.