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 🙏

© 2026 – Pkg Stats / Ryan Hefner

formikate

v0.3.18

Published

[![Checks](https://github.com/Wildhoney/Formikate/actions/workflows/checks.yml/badge.svg)](https://github.com/Wildhoney/Formikate/actions/workflows/checks.yml)

Readme

Formikate

Checks

Lightweight form builder for React that lets you dynamically render form fields from validation schemas, manage multi-step flows, and simplify validation handling.

View Live Demo

Features

  • Dynamically render form fields using zod validation schemas
  • Declarative multi-step forms via useFields configuration
  • Inactive fields are automatically reset to their default values
  • Steps without active fields are automatically skipped during navigation
  • Per-step validation — only fields on the current step (or earlier) are validated on submit

Getting started

Begin by defining your validation schema and field descriptors:

import * as z from 'zod';

export const schema = z.object({
    name: z.string().min(1, 'Name is required'),
    address: z.string().min(1, 'Address is required'),
    guest: z.boolean(),
});

export type Schema = z.infer<typeof schema>;

export const fields = {
    name: { step: 'personal' as const, validate: schema.shape.name, value: '' },
    address: {
        step: 'delivery' as const,
        validate: schema.shape.address,
        value: '',
    },
    guest: {
        step: 'personal' as const,
        validate: schema.shape.guest,
        value: false,
    },
};

Import useForm – it accepts all of the same useFormik (Formik) arguments (except validate, validationSchema, and initialValues which are handled internally). Initial values are derived from each field's value property:

import { useForm, useFields, Position } from 'formikate';
import { fields } from './utils';

const form = useForm<Schema>({
    fields,
    validateOnBlur: false,
    validateOnChange: false,
    onSubmit(values) {
        if (!form.status.progress.last)
            return void form.status.navigate.to(Position.Next);
        console.log('Submitting', values);
    },
});

You can use form to access all of the usual Formik properties such as form.values and form.errors.

Defining Steps and Fields

Use useFields to declare the step structure and field configuration. The step property on each field is strongly typed — it must match one of the identifiers in the steps array:

useFields(form, () => ({
    steps: ['personal', 'delivery', 'review'],
    fields: {
        ...fields,
        address: {
            ...fields.address,
            active: form.values.guest === false,
        },
    },
}));

Config Shape

| Property | Type | Description | | -------- | -------------------------------- | ----------------------------------------- | | steps | (string \| number \| symbol)[] | Ordered list of step identifiers | | fields | Record<string, FieldConfig> | Map of field names to their configuration |

Field Config

| Property | Type | Description | | ---------- | ---------------------------- | --------------------------------------------------------------------------------------------------------------- | | step | string \| number \| symbol | Which step this field belongs to — must match one of the identifiers in steps | | validate | ZodType | Zod schema used for validation | | value | unknown | Default/reset value for the field — also used as the initial value when passed to useForm | | active | boolean? | Whether the field is active (default true). Inactive fields are excluded from validation and reset to value |

Automatic Step Skipping

Steps where all fields have active: false are automatically skipped during navigation:

useFields(form, () => ({
    steps: ['personal', 'delivery', 'review'],
    fields: {
        ...fields,
        address: {
            ...fields.address,
            active: form.values.guest === false,
        },
    },
}));

When guest is true, the address field is inactive, so the delivery step is skipped.

Status

After calling useFields, the computed state is available on form.status:

form.status.empty; // boolean — true when no fields/steps are configured
form.status.field; // Record<string, { exists(), required, optional }>
form.status.progress; // step progression state
form.status.navigate; // navigation controls

Field State

form.status.field.name.exists(); // true if the field is active
form.status.field.name.required; // true if the Zod schema rejects `undefined`
form.status.field.name.optional; // inverse of required

Progress

form.status.progress.current; // identifier of the current step
form.status.progress.position; // zero-based index within visible steps
form.status.progress.total; // total number of visible steps
form.status.progress.first; // whether on the first visible step
form.status.progress.last; // whether on the last visible step
form.status.progress.steps; // array of { id, index } for visible steps
form.status.progress.step; // map of step id → { visible, current }

Navigation

import { Position } from 'formikate';

form.status.navigate.to(Position.Next); // go to next step
form.status.navigate.to(Position.Previous); // go to previous step
form.status.navigate.to(Position.First); // go to first step
form.status.navigate.to(Position.Last); // go to last step
form.status.navigate.to('review'); // go to a specific step by id

form.status.navigate.exists(Position.Next); // true if a next step exists
form.status.navigate.exists(Position.Previous); // true if a previous step exists
form.status.navigate.exists('review'); // true if a specific step is reachable

Rendering

Use Formikate's Form component to provide the form to child components:

import { Form, Position } from 'formikate';

<Form value={form}>
    <form onSubmit={form.handleSubmit}>
        {form.status.field.name.exists() && (
            <input type="text" {...form.getFieldProps('name')} />
        )}

        {form.status.field.address.exists() && (
            <input type="text" {...form.getFieldProps('address')} />
        )}

        <button
            type="button"
            disabled={!form.status.navigate.exists(Position.Previous)}
            onClick={() => form.status.navigate.to(Position.Previous)}
        >
            Back
        </button>

        <button type="submit">
            {form.status.progress.last ? 'Submit' : 'Next'}
        </button>
    </form>
</Form>;

Accessing Form in Child Components

Use the useFormContext hook in child components to access the form with properly typed status:

import { useFormContext } from 'formikate';
import type { Schema } from './types';

function NameField() {
    const form = useFormContext<Schema>();

    if (!form.status.field.name.exists()) return null;

    return <input type="text" {...form.getFieldProps('name')} />;
}

Empty State

When all fields are inactive, form.status.empty is true:

{
    form.status.empty ? (
        <p>No fields available</p>
    ) : (
        <form onSubmit={form.handleSubmit}>{/* ... */}</form>
    );
}