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

@novahelm/forms

v2026.6.1

Published

NovaHelm forms — defineForm() schema-driven forms and FormRenderer.

Readme

@novahelm/forms

Declarative, type-safe form system for NovaHelm applications.

Define forms once in TypeScript, validate on the server with auto-generated Zod schemas, and render them anywhere with the built-in React renderer.


Quick Start

pnpm add @novahelm/forms
import { defineForm, FormRenderer } from "@novahelm/forms";

const contactForm = defineForm({
  slug: "contact",
  title: "Contact Us",
  fields: [
    { name: "name",    type: "text",  required: true },
    { name: "email",   type: "email", required: true },
    { name: "message", type: "richtext", multiline: true },
  ],
  onSubmit: "api",
  submitEndpoint: "/api/contact",
});

// Render in any React component
export function ContactPage() {
  return (
    <FormRenderer
      form={contactForm}
      onSubmit={async (values) => {
        await fetch("/api/contact", { method: "POST", body: JSON.stringify(values) });
      }}
    />
  );
}

Field Types

| Category | Types | |----------|-------| | Text | text, richtext, slug, email, url, color, phone | | Numeric | number, integer, currency, rating | | Boolean | boolean | | Choice | select, multiselect, tags | | Date/Time | date, dateonly, time | | Relation | relation | | Media | image, file, video, gallery | | Structured | json, array | | AI | vector |


Server-Side Validation

buildFormSchema() generates a Zod schema from your form config. Use it in tRPC procedures, API routes, or any server-side validation:

import { buildFormSchema, buildFormDefaults } from "@novahelm/forms";

// In a tRPC procedure
const schema = buildFormSchema(contactForm);

export const contactRouter = router({
  submit: publicProcedure
    .input(schema)
    .mutation(async ({ input }) => {
      // input is fully typed based on your form fields
      await sendEmail(input.email, input.message);
    }),
});

Conditional Visibility

Show or hide fields based on other fields' values using visibleWhen:

defineForm({
  slug: "feedback",
  title: "Feedback",
  fields: [
    {
      name: "satisfied",
      type: "boolean",
      label: "Are you satisfied?",
    },
    {
      name: "reason",
      type: "text",
      label: "Why not?",
      visibleWhen: { field: "satisfied", op: "eq", value: false },
    },
  ],
});

Supported operators: eq (default), neq, in, gt, lt


Sections

Group fields into collapsible sections:

defineForm({
  slug: "profile",
  title: "Edit Profile",
  sections: [
    { id: "personal", label: "Personal Info" },
    { id: "contact",  label: "Contact Details", collapsible: true },
  ],
  fields: [
    { name: "name",  type: "text",  section: "personal" },
    { name: "bio",   type: "richtext", section: "personal", multiline: true },
    { name: "email", type: "email", section: "contact" },
    { name: "phone", type: "phone", section: "contact" },
  ],
});

Collection Adapter

Auto-generate a form from an admin-kit collection — no duplication:

import { collectionToForm } from "@novahelm/forms";
import { postsCollection } from "@/collections/posts";

// "create" mode: title = "Create Post", submit label = "Create"
const createForm = collectionToForm(postsCollection, "create");

// "edit" mode (default): title = "Post", submit label = "Save"
const editForm = collectionToForm(postsCollection, "edit");

Fields with showInForm: false or admin.formHidden: true are automatically excluded.


Extending Forms

Extend an existing form — useful for multi-step flows, locale variants, or restricted versions:

import { extendForm } from "@novahelm/forms";

const shortContactForm = extendForm(contactForm, {
  title: "Quick Contact",
  fields: contactForm.fields.filter(f => f.required),
});

Form Registry

Register forms centrally and look them up at runtime (useful for dynamic form rendering):

import { registerForm, getForm } from "@novahelm/forms";

registerForm(contactForm);

// Later, in a route handler:
const form = getForm("contact");
if (!form) throw new Error("Form not found");

API Reference

| Export | Description | |--------|-------------| | defineForm(config) | Create a form definition with defaults applied | | extendForm(base, overrides) | Extend an existing form | | registerForm(form) | Add a form to the global registry | | getForm(slug) | Look up a form by slug | | getForms() | Return all registered forms | | buildFormSchema(form) | Generate a Zod validation schema | | buildFormDefaults(form) | Generate initial form values | | collectionToForm(collection, mode?) | Convert admin-kit collection to form | | <FormRenderer form onSubmit /> | Render a complete form | | <FieldRenderer field value onChange /> | Render a single field | | evaluateCondition(condition, values) | Evaluate a visibleWhen rule |