npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-hook-form-wizard

v0.1.7-alpha

Published

A simple wizard for react-hook-form

Downloads

113

Readme

react-hook-form-wizard

A simple wizard for react-hook-form

Inspired by Brian Yang's multi-step wizard and the wizard form example on the react-hook-form website

I'm still new to React so don't beat me up too bad. If you'd like to provide feedback or contribute please let me know. This is still in development.

Limitations

Currently only local storage is supported


Components Included

<Wizard>
    <Progress />
    <Pages>
        <Page>
            <YourCustomPageComponent />
        </Page>
        <Page>
            {(dataContext, formContext, wizardContext) => {
                -- Form fields go here with access to context methods via render prop --
            }}
        </Page>
    </Pages>
    <Navigation />
</Wizard>

Component API

Wizard

| Prop | Type | Required | Description | | ------------- | ------------------------------------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | | useFormArgs | Object | | Same arguments passed into useForm, see useForm | | initialPage | number | | Which page the wizard should start. Zero-based index. | | onSubmit | ({ dataContext, formContext, wizardContext}) => void | Yes | The submit function that will run on the final page of the form. | | enableDevTool | boolean | | Enable DevTool component include in little-state-machine, see docs |

Progress

This component is just for example purposes. Would likely not be used in a real-world scenario.

Pages

This component is a container component for Page components

Page

This component can contain your own components but also exposes render props for using included contexts. See basic usage example.

Navigation

This component is just for example purposes. Would likely not be used in a real-world scenario.


Hooks API

| Hook | State / Methods | Return / Argument | Description | | ---------------- | ----------------- | --------------------------- | ----------------------------------------------------------------------------- | | useDataContext | see below | | Hooks into the little-state-machine store. | | | action(payload) | (payload: Object) => void | Method to update store state. | | | state | Object | Returns store state. | | useFormContext | same as useForm | | see docs for useFormContext | | useWizardContext | see below | | Hooks into several states and methods for managing the wizard. | | | activePage | number | Returns the active page that the wizard is currently on. Zero-based index. | | | pageTotal | number | Returns the total number of Page components within the Pages component. | | | previousPage() | () => {} | Method for navigating to the previous page. | | | nextPage() | () => {} | Method for navigating to the next page. | | | goToPage(index) | (index: number) => void | Method for navigating to a particular page. Be careful for out of bounds. | | | isLastPage | boolean | Whether the active page is the last page. |


Basic Example

See Basic example demo