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

@reckona/mreact-forms

v0.0.194

Published

Reactive form state and validation utilities for mreact.

Readme

@reckona/mreact-forms

@reckona/mreact-forms provides form state and validation utilities for mreact. It tracks field values, dirty/touched state, client validation, and server errors through a small reactive API.

Basic Usage

import { createForm } from "@reckona/mreact-forms";

const form = createForm({
  initialValues: { email: "" },
  validate: {
    email(value) {
      return value.includes("@") ? undefined : "Invalid email";
    },
  },
});

await form.field("email").setValue("[email protected]");
await form.validate();

Fields also expose a binding helper for components that want the usual value and event props in one place:

const email = form.field("email");
const binding = email.bind();

input({
  value: binding.value,
  onInput: binding.onInput,
  onBlur: binding.onBlur,
});

Use field.bind({ event: "change" }) for controls such as <select> that should update on change instead of input. binding.value is read live from form state, so repeated reads after validation or reset return the current value.

Valibot And Standard Schema

createForm accepts Standard Schema compatible validators through the schema option. Valibot and Zod v4 expose Standard Schema metadata directly, so schemas can be passed without an adapter. The form state keeps input values, while submit() receives the schema output after transforms run.

import { createForm } from "@reckona/mreact-forms";
import * as v from "valibot";

const signupSchema = v.object({
  email: v.pipe(v.string(), v.trim(), v.email("Enter a valid email.")),
  seats: v.pipe(
    v.string(),
    v.trim(),
    v.toNumber("Seats must be a number."),
    v.integer("Seats must be a whole number."),
    v.minValue(1, "Choose at least one seat."),
  ),
});

type SignupValues = v.InferInput<typeof signupSchema>;
type SignupSubmitValues = v.InferOutput<typeof signupSchema>;

const signupForm = createForm<SignupValues, SignupSubmitValues>({
  initialValues: { email: "", seats: "1" },
  schema: signupSchema,
  validateOn: ["blur", "submit"],
});

await signupForm.submit((values) => {
  values.seats;
  //    ^ number
});

The same pattern works with Zod v4:

import { createForm } from "@reckona/mreact-forms";
import * as z from "zod/v4";

const inviteSchema = z.object({
  email: z.string().trim().email("Enter a valid email."),
  seats: z
    .string()
    .trim()
    .transform((value) => Number(value))
    .pipe(z.number().int().min(1)),
});

type InviteValues = z.input<typeof inviteSchema>;
type InviteSubmitValues = z.output<typeof inviteSchema>;

const inviteForm = createForm<InviteValues, InviteSubmitValues>({
  initialValues: { email: "", seats: "1" },
  schema: inviteSchema,
  validateOn: ["blur", "submit"],
});

await inviteForm.submit((values) => {
  values.seats;
  //    ^ number
});

Core APIs

  • createForm() creates reactive form state.
  • form.field(name).bind() returns { value, onInput, onChange, onBlur } and handles string values and boolean checkbox-style values. Pass { event: "change" } to update from onChange; the default updates from onInput.
  • form.fieldArray(name) returns stable keyed rows and append, insert, move, remove, and swap helpers for array-valued form fields.
  • Field state includes validating, which is true while the latest async field validator is pending. Slower stale validator results are ignored.
  • Field validators can use { validate, deps } when one field should be revalidated after another field changes or blurs.
  • setServerErrors() applies errors returned by a route handler or server action.
  • form.submit() dedupes concurrent submissions and keeps submitting true until the active validation and handler finish.
  • form.reset() restores the initial values.
  • The schema option connects forms to Standard Schema compatible validators such as zod and valibot.

Server Action And Route Handler Integration

Use client validation for fast feedback, then run server validation for authorization rules, database constraints, and other trusted checks. Return server errors to the form with setServerErrors().