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

@smatt92/uxspec-form

v0.2.3

Published

UX contracts for predictable form feedback

Readme

npm version

uxspec-form

UX contracts for predictable form feedback

Forms don’t fail validation.
They fail UX.

uxspec-form lets you control when feedback appears and how it feels — without changing validation rules or form libraries.


Why this exists

Most form libraries answer:

“Is this field valid?”

Users experience a different problem:

“Why is this error showing right now?”

uxspec-form separates validation from UX behavior.


What this library does

✔ Decide when errors appear (change | blur | submit)
✔ Decide how errors feel (polite | assertive)
✔ Control success feedback
✔ Prevent layout shift
✔ Work with existing form libraries

❌ Does NOT validate data
❌ Does NOT render UI
❌ Does NOT replace your form library


The mental model

Forms report facts.
Fields decide behavior.

The form tells a field:

  • is there an error?
  • has the user interacted?
  • is the value valid?
  • was the form submitted?

The field decides:

  • should feedback appear now?
  • what UX state applies?

Installation

npm install @smatt92/uxspec-form

Core idea (framework-agnostic)

import { uxField } from "@smatt92/uxspec-form"

const emailUX = uxField({
  name: "email",
  validateOn: "blur",
  errorTone: "polite",
  successFeedback: "subtle",
  reserveErrorSpace: true
})

This is a UX contract, not a validator.

React Hook Form example

import { useForm } from "react-hook-form"
import { useReactHookFormUX } from "@smatt92/uxspec-form"

const form = useForm()

const ux = useReactHookFormUX({
  config: {
    name: "email",
    validateOn: "blur",
    successFeedback: "subtle",
    reserveErrorSpace: true
  },
  error: form.formState.errors.email,
  touched: form.formState.touchedFields.email,
  isValid: !form.formState.errors.email,
  isSubmitted: form.formState.isSubmitted
})
<input {...form.register("email", { required: true })} />

<div className={ux.helperClassName}>
  {ux.showError && "Email is required"}
  {ux.showSuccess && "Looks good"}
</div>

What you get back

{
    showError: boolean
    showSuccess: boolean
    errorClassName: string
    helperClassName: string
}

You decide what to render. UXSpec decides when.

Why this is different

| Typical forms | uxspec-form | | ------------------------- | --------------------------- | | Errors appear immediately | Errors appear intentionally | | UX rules are implicit | UX rules are explicit | | Validation drives UX | UX drives feedback | | Hard to reuse | Portable UX contracts |

Version

v0.2.3

Stable UX core React Hook Form adapter Deterministic UX behavior

License

MIT