Registry fields

@schema-engine/forms-react ships no element registrations: the field implementations are code you own. You can write your own with Writing a widget, or, in a project that already uses shadcn, copy the ready-made ones the shadcn registry installs. This page covers the second path. The install, the CSS and the barrel imports are in Installation and quick start.

After the install, import the generated registration barrel through your app's own alias and register it:

import { createFormEngine } from '@schema-engine/forms';
import { schemaFormRegistrations } from '@/components/schema-engine/forms/registrations';

const engine = createFormEngine({ elements: schemaFormRegistrations });

What the registry installs

The aggregate schema-form item installs these elements, and schemaFormRegistrations lists each of them:

$typePurpose
inputText, email, password, URL, telephone, and date inputs
textareaMulti-line text
numberNumeric input
selectSelect menu
checkbox, checkbox-groupBoolean and multi-choice inputs
radioSingle-choice group
switchBoolean toggle
sliderNumeric range
comboboxSearchable choice input
dateCalendar popover for a single ISO date
date-rangeCalendar popover for a range of two dates
drop-zoneFile drop input
fieldSetGrouped content
input-otpOne-time-password input
phone-input, masked-inputSpecialized text inputs
arrayElementsRepeated element groups
submit, submission-alertAction and submission feedback

Own them

The files are yours. Edit one to change how a field looks or behaves, remove its registration from the barrel to drop it, or replace one by listing your own registration of the same $type after the barrel. The registry item is an installation boundary: applications can select a smaller set of registrations or replace one before building the engine.

import { createFormEngine } from '@schema-engine/forms';
import { schemaFormRegistrations } from '@/components/schema-engine/forms/registrations';
import { myInput } from './my-input';

export const engine = createFormEngine({ elements: [...schemaFormRegistrations, myInput] });

A later registration with the same $type replaces the earlier one without a warning. To write myInput, see Writing a widget.

See them

This form renders with the registry's input field and card recipe, from the files shadcn add copies. Submit it empty to see the required messages. A valid submit shows the notice the config names with a show_notification action; nothing is sent.

Contact us

Rendered by the copied shadcn input and card recipe.

const shadcnContactFormConfig: FormConfig = {
	id: 'shadcn-contact',
	title: 'Contact us',
	description: 'Rendered by the copied shadcn input and card recipe.',
	view: {
		$type: 'card',
		shell: {
			appearance: {
				size: 'default',
				surface: 'elevated'
			}
		},
		header: {
			align: 'center',
			size: 'md'
		}
	},
	steps: [
		{
			id: 'details',
			title: 'Contact us',
			elements: [
				{
					$type: 'input',
					id: 'name',
					name: 'name',
					label: 'Full name',
					rules: [
						{
							$type: 'required',
							message: 'Name is required'
						}
					]
				},
				{
					$type: 'input',
					id: 'email',
					name: 'email',
					label: 'Email',
					inputType: 'email',
					rules: [
						{
							$type: 'required',
							message: 'Email is required'
						},
						{
							$type: 'email',
							message: 'Enter a valid email'
						}
					]
				}
			]
		}
	],
	actions: [
		{
			id: 'sent',
			$type: 'show_notification',
			message: 'Message sent.',
			variant: 'success',
			triggers: [
				'form_submit_success'
			]
		}
	]
};

The engine registers the copied field and recipe like any app's would:

import { createFormEngine } from '@schema-engine/forms';
import { InputElementRegistration } from '@/components/schema-engine/forms/inputs/form-input.registration';
import { CardRecipe } from '@/components/schema-engine/forms/recipes/registrations/card';

const engine = createFormEngine({
	elements: [InputElementRegistration],
	recipes: [CardRecipe],
});

The provider, the renderer and the copied field's hooks all import @schema-engine/forms-react from the one package, so they share one React context. A bundle that ends up with two copies of the package splits the context, and the field then throws a missing-provider error: keep one copy in your app. The shadcn registry README lists every item.

Element configuration

Every field has a $type and name; the remaining properties come from that registration's schema. Shared properties include label, description, defaultValue, rules, constraints, grid, className, and style. className and style are escape hatches: style accepts only CSS custom properties (keys that start with --) and validation rejects any other key.

{
	"$type": "input",
	"id": "email",
	"name": "email",
	"label": "Email address",
	"inputType": "email",
	"rules": [
		{ "$type": "required", "message": "Email is required" },
		{ "$type": "email", "message": "Enter a valid email" }
	]
}

Responsive placement belongs to the element's grid property (named width and offset, an area of the grid's areas, or raw lines) and the form's top-level grid configuration, which a step can replace with its own grid; see Placing fields in the grid. View chrome belongs to view, not to a step or element; see View recipes.