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

@page-speed/forms

v0.5.1

Published

Ultra-high-performance React form library with field-level reactivity and tree-shakable architecture

Readme

Page Speed React Forms

@page-speed/forms

Type-safe, high-performance React form state and input components for OpenSite/DashTrack workloads.

npm version npm downloads License

Highlights

  • Field-level reactivity via @legendapp/state/react
  • Typed useForm and useField APIs
  • Built-in input library (text, select, date, time, upload, rich text)
  • Tree-shakable subpath exports (/core, /inputs, /validation, /upload, /integration)
  • Validation rules and utilities (sync + async)
  • Valibot adapter in a separate entrypoint (/validation/valibot)
  • Tailwind token-based default UI aligned with ShadCN interaction patterns

Installation

pnpm add @page-speed/forms
# or
npm install @page-speed/forms

Peer dependencies:

  • react >= 16.8.0
  • react-dom >= 16.8.0

Quick Start

import * as React from "react";
import { Form, Field, useForm } from "@page-speed/forms";
import { TextInput, Select } from "@page-speed/forms/inputs";
import { required, email } from "@page-speed/forms/validation/rules";

export function ContactForm() {
  const form = useForm({
    initialValues: {
      fullName: "",
      email: "",
      inquiryType: "",
    },
    validationSchema: {
      fullName: required(),
      email: [required(), email()],
      inquiryType: required(),
    },
    onSubmit: async (values) => {
      console.log(values);
    },
  });

  return (
    <Form form={form}>
      <Field name="fullName" label="Full Name" required>
        {({ field, meta }) => (
          <TextInput
            {...field}
            placeholder="Your name"
            error={Boolean(meta.touched && meta.error)}
          />
        )}
      </Field>

      <Field name="email" label="Email" required>
        {({ field, meta }) => (
          <TextInput
            {...field}
            type="email"
            placeholder="[email protected]"
            error={Boolean(meta.touched && meta.error)}
          />
        )}
      </Field>

      <Field name="inquiryType" label="Inquiry Type" required>
        {({ field, meta }) => (
          <Select
            {...field}
            options={[
              { label: "General", value: "general" },
              { label: "Sales", value: "sales" },
              { label: "Support", value: "support" },
            ]}
            error={Boolean(meta.touched && meta.error)}
          />
        )}
      </Field>

      <button type="submit" disabled={form.isSubmitting}>
        Submit
      </button>
    </Form>
  );
}

Package Entry Points

Main

  • @page-speed/forms

Exports:

  • useForm, useField, Form, Field, FormContext
  • core form/types interfaces

Inputs

  • @page-speed/forms/inputs

Exports:

  • TextInput
  • TextArea
  • Checkbox
  • CheckboxGroup
  • Radio
  • Select
  • MultiSelect
  • DatePicker
  • DateRangePicker
  • TimePicker
  • FileInput

Validation

  • @page-speed/forms/validation
  • @page-speed/forms/validation/rules
  • @page-speed/forms/validation/utils
  • @page-speed/forms/validation/valibot

Upload and Integration

  • @page-speed/forms/upload
  • @page-speed/forms/integration

Input Notes

TimePicker

TimePicker now uses a native input[type="time"] UX internally.

  • Accepts controlled values in HH:mm (24-hour) or h:mm AM/PM (12-hour)
  • Emits HH:mm when use24Hour is true
  • Emits h:mm AM/PM when use24Hour is false

DatePicker and DateRangePicker

  • Calendar popovers close on outside click
  • Compact month/day layout using tokenized Tailwind classes
  • DateRangePicker renders two months and highlights endpoints + in-range dates

Select and MultiSelect

  • Close on outside click
  • Search support
  • Option groups
  • Selected options inside the menu use accent highlight styles

Styling (Tailwind 4 + Semantic Tokens)

This library ships with Tailwind utility classes and semantic token class names.

It is not a BEM-only unstyled package anymore.

Base conventions

  • Inputs/triggers are transparent shells with semantic borders/rings
  • Fields with values (text-like controls) use ring-2 ring-ring
  • Error states use destructive border/ring
  • Dropdown selected rows use muted backgrounds

Autofill normalization

Text-like controls apply autofill reset classes to avoid browser-injected background/text colors breaking your theme contrast.

See INPUT_AUTOFILL_RESET_CLASSES in src/utils.ts.

Token requirements

Ensure your app defines semantic tokens used in classes such as:

  • background, foreground, border, input, ring
  • primary, primary-foreground
  • muted, muted-foreground
  • destructive, destructive-foreground
  • popover, popover-foreground
  • card, card-foreground

For complete styling guidance, see docs/STYLES.md.

Validation Utilities

Use built-in rules:

  • required, email, url, phone
  • minLength, maxLength, min, max
  • pattern, matches, oneOf
  • creditCard, postalCode, alpha, alphanumeric, numeric, integer
  • compose

Use utilities from /validation/utils:

  • debounce, asyncValidator, crossFieldValidator, when
  • setErrorMessages, getErrorMessage, resetErrorMessages

File Uploads

FileInput supports validation, drag/drop, preview, and crop workflows.

For full two-phase upload patterns and serializer usage, see:

Development

pnpm test:ci
pnpm build
pnpm type-check

License

MIT. See LICENSE.