easy-forms
API reference

Registry & EasyForm

The @easy-forms shadcn registry, the files it ejects, easyFormsRegistry, and the EasyForm wrapper.

The UI ships as a shadcn registry, not an npm package. You add components with the shadcn CLI and they're copied into your repo under @/components/easy-forms/ — you own them.

Install

Add the @easy-forms namespace to components.json, then add the kit:

components.json
{
	"registries": {
		"@easy-forms": "https://chandima301.github.io/easy-forms/r/{name}.json"
	}
}
npx shadcn@latest add @easy-forms/easy-form

See Installation for the full setup.

Registry items

ItemWhat you get
@easy-forms/easy-formThe whole kit: every renderer + registry.ts + group-renderer.tsx + wizard.tsx + the <EasyForm> wrapper.
@easy-forms/registryregistry.ts — the assembled easyFormsRegistry (pulls all renderers).
@easy-forms/field-shellFieldShell — the shared label + description + inline-error wrapper.
@easy-forms/text, …/email, …/number, …/textarea, …/select, …/multiselect, …/checkbox, …/checkbox-list, …/radio-group, …/date, …/file, …/customOne renderer per control. Each pulls field-shell + the canonical shadcn primitives it needs.
@easy-forms/group-rendererGroupRenderer — draws a group's fields, owns the grid/stack layout, and CSS-hides hidden groups.
@easy-forms/wizardWizard — the linear multi-step shell over core's useWizardRuntime.

Add the whole kit (@easy-forms/easy-form) or just the controls you need (npx shadcn@latest add @easy-forms/select).

<EasyForm>

The pre-wired shell scaffolded at @/components/easy-forms/easy-form.tsx. It calls useFormRuntime for all behaviour and renders only the container, header, body, and footer — so you can restyle it freely without being able to break form behaviour.

import { EasyForm } from '@/components/easy-forms/easy-form';

<EasyForm schema={schema} initialValues={initialValues} onSubmit={onSubmit} />;
PropTypeDefaultDescription
schema*FormSchema<TFormData>The form definition.
onSubmit*(values: TFormData) => void | Promise<void>Called with the validated, visible values on submit.
initialValuesPartial<TFormData>Initial field values.
storeFormStoreProvide an external store instead of creating one internally.
dependencyHandlersDependencyHandlerRegistryAdditional or replacement dependency handlers, merged over the defaults.
pluginsFormPlugin[]Lifecycle plugins (logger, autosave, custom).
submitLabelstring'Submit'Submit button label.
resetLabelstring'Reset'Reset button label.
showResetbooleanfalseShow a reset button in the footer.
classNamestringClass applied to the form element.
wizardNextLabelstringOverride the wizard Next label.
wizardPreviousLabelstringOverride the wizard Previous label.

When schema.wizard is present, <EasyForm> renders <Wizard> instead of a single page and lets it own the submit flow. Hidden fields — via field or group visibility — are excluded from the onSubmit payload.

easyFormsRegistry

The assembled control → renderer map at @/components/easy-forms/registry.ts. It's the registry <EasyForm> provides via RendererRegistryContext. Edit it to add a control or point one at your own renderer — see Theming & customization.

Files you own

shadcn add @easy-forms/easy-form writes into your repo:

  • components/easy-forms/*-renderer.tsx — one per control (e.g. text-renderer.tsx, dropdown-renderer.tsx).
  • components/easy-forms/field-shell.tsx, registry.ts, easy-form.tsx, group-renderer.tsx, wizard.tsx.
  • components/ui/* — the canonical shadcn primitives the renderers use (input, select, checkbox, radio-group, popover, label, textarea).

All of it is editable. Each renderer is a React component typed RendererProps<TQuestion> (question, value, onChange, onBlur, error, errors, touched, dirty); see Theming for how to build or swap one.