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

@formjourney/react

v0.1.0

Published

React bindings for @formjourney/core — Provider + hooks (useField/useStep/useForm) that make headless multi-step forms clé en main

Downloads

156

Readme

@formjourney/react

React bindings for @formjourney/core. A provider puts a form on the context; hooks read and write it with the right re-renders, and no manual store subscriptions.

Install

pnpm add @formjourney/react @formjourney/core react

Setup

Create the form once, wrap your tree in FormProvider, and build typed hooks for your values type.

import { createForm } from '@formjourney/core';
import { createFormHooks, FormProvider } from '@formjourney/react';
import { useMemo } from 'react';

interface Values {
  email: string;
  tags: { label: string }[];
}

const { useField, useStep, useForm, useFieldList } = createFormHooks<Values>();

const App = () => {
  const form = useMemo(
    () =>
      createForm<Values>({
        initialValues: { email: '', tags: [] },
        steps: [{ id: 'main' }],
      }),
    [],
  );
  return (
    <FormProvider form={form} mode="onSubmit" reValidateMode="onChange">
      <Fields />
    </FormProvider>
  );
};

createFormHooks<Values>() closes over your type so every hook autocompletes paths and infers value types — you never pass the generic again.

useField

Binds one field. register() spreads onto an <input>; it writes on change and marks the field touched on blur.

const { value, error, touched, register, setValue } = useField('email');

<input {...register()} />;
<input type="checkbox" {...register({ type: 'checkbox' })} />;
{
  error && <span>{error}</span>;
}

useStep

Navigation and per-step validation. next() validates the current step and advances only if it passes; errors are written to the store so fields can show them. Conditional (hidden) steps are respected automatically.

const { currentStep, activeSteps, index, isFirst, isLast, next, prev, goTo } =
  useStep();

useForm

Whole-form state and submit. Derived flags come straight from the core; handleSubmit runs the core submit lifecycle.

const {
  values,
  errors,
  isDirty,
  isValid,
  isSubmitting,
  submitCount,
  reset,
  resetField,
  trigger,
  handleSubmit,
} = useForm();

<form onSubmit={handleSubmit(async (values) => api.save(values))}>...</form>;

useFieldList

A dynamic array of fields. Errors follow their element across reorders and removals.

const { items, append, removeAt, moveItem, swapItems } = useFieldList('tags');

{
  items.map((_, i) => <TagInput key={i} index={i} />);
}
<button onClick={() => append({ label: '' })}>Add</button>;

useObserve

Reactively read one path, or the whole form with no argument.

const email = useObserve('email');
const all = useObserve();

useControl / Control

For controlled components that take a value, not a DOM event (custom selects, UI-library inputs). onChange receives the value directly.

const { value, error, onChange, onBlur } = useControl('email');
<MySelect value={value} onChange={onChange} onBlur={onBlur} />;

Or the render-prop form:

<Control name="email">
  {(c) => <MySelect value={c.value} onChange={c.onChange} />}
</Control>

Validation modes

FormProvider takes mode and reValidateMode (onSubmit | onChange | onBlur).

  • mode — when a field is first validated, before it has an error.
  • reValidateMode — how a field re-validates once it already shows an error.

mode="onSubmit" with reValidateMode="onChange" is the common pairing: no errors while the user first types, but once an error appears it clears itself as they fix the field.

Plugin hooks

useDevtools() reads a plugin API off the form (defaults to devtools) and throws a clear message when the plugin is not registered.

License

MIT