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

@identityofsine/radioactive-forms

v2.2.4

Published

Powerful forms for React

Readme

Radioactive Forms

Type-safe, reactive forms for React.

Overview

  • Typed controls with validators
  • Nested forms and arrays of forms/controls
  • Reactive updates via a lightweight hook
  • Readonly/disabled modes and dirty/touched tracking
  • Build fully typed output objects with form.build()

Installation

npm i @identityofsine/radioactive-forms

Quickstart

import { useForm, Validators, Form } from '@identityofsine/radioactive-forms';

type Profile = { name: string; email: string; age: number; agree: boolean };

export function Example() {
  const { form } = useForm<Profile>({
    name: ['', [Validators.required]],
    email: ['', [Validators.required]],
    age: [18, []],
    agree: [false, []],
  });
  const controls = (form as unknown as { controls: Record<string, any> })?.controls;
  return (
    <>
      <input value={String(controls?.name.value ?? '')} onChange={e => controls?.name && (controls.name.value = e.target.value)} />
      <button disabled={!form?.valid || form?.readonly} onClick={() => console.log(Form.isForm(form) ? form.build() : undefined)}>Submit</button>
    </>
  );
}

Core Concepts

  • Form template: { field: [initialValue, [validators...]] }
  • Form state: valid, dirty, touched, readonly, disabled
  • Form methods: reset(), patchValue(partial), build(); static Form.isForm(obj)
  • FormControl<T, O>: .value setter triggers validation, .reset(), .patchValue()
  • Validators: Validators.required
  • Nesting: controls can hold nested Form or arrays of Form/FormControl

API Surface

  • useForm<T>(template, options?, deps?) => { form?: Form<T> }
  • Form<T>: .controls, .invalids, .getControl(key), .addControls(map), .readonly, .disabled, .reset(), .patchValue(), .build()
  • FormControl<T, O>: .value, .readonly, .disabled, .reset(), .patchValue()
  • Validators: required
  • React context: FormGroup for providing form via context
  • React hook: useFormGroup<T>(options?) => { form?: Form<T> }

useFormGroup Example

import { FormGroupProvider, useFormGroup, useForm } from '@identityofsine/radioactive-forms';

type Profile = { name: string; email: string };

function Child() {
  const { form } = useFormGroup<Profile>({ required: true });
  const controls = (form as any)?.controls;
  return (
    <input value={String(controls?.name.value ?? '')} onChange={e => controls?.name && (controls.name.value = e.target.value)} />
  );
}

export function Parent() {
  const { form } = useForm<Profile>({ name: ['', []], email: ['', []] });
  return (
    <FormGroupProvider form={form}>
      <Child />
    </FormGroupProvider>
  );
}

Examples / Local Development

The example app (development environment) lives in example/basic-react-forms and hot-reloads against local sources.

npm run example:install
npm run example:dev

This runs Vite in example/basic-react-forms, which is configured to use the local src/index.ts so you can develop the library and see changes live.

Testing & Type-Checking

npm run test
npm run test:watch
npm run test:coverage
npm run typecheck

Contributing

PRs welcome! Use the example app for local development and run tests and type checks before submitting.

License

MIT