---
title: 'Registry fields (optional)'
description: 'The field elements the shadcn registry installs, how to import and own them, and how to configure one in a form.'
order: 7
---

import { ShadcnFormDemoEmbed } from '@/components/react-form-demo/shadcn-form-demo-embed';
import { FormConfigCode } from '@/components/form-config-code';
import { shadcnContactFormConfig } from '@/lib/form-configs/shadcn-example';

# 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](/docs/forms-react/widgets), 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](/docs/forms-react/getting-started#optional-start-from-the-shadcn-registry).

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

```ts
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:

| `$type`                       | Purpose                                                |
| ----------------------------- | ------------------------------------------------------ |
| `input`                       | Text, email, password, URL, telephone, and date inputs |
| `textarea`                    | Multi-line text                                        |
| `number`                      | Numeric input                                          |
| `select`                      | Select menu                                            |
| `checkbox`, `checkbox-group`  | Boolean and multi-choice inputs                        |
| `radio`                       | Single-choice group                                    |
| `switch`                      | Boolean toggle                                         |
| `slider`                      | Numeric range                                          |
| `combobox`                    | Searchable choice input                                |
| `date`                        | Calendar popover for a single ISO date                 |
| `date-range`                  | Calendar popover for a range of two dates              |
| `drop-zone`                   | File drop input                                        |
| `fieldSet`                    | Grouped content                                        |
| `input-otp`                   | One-time-password input                                |
| `phone-input`, `masked-input` | Specialized text inputs                                |
| `arrayElements`               | Repeated element groups                                |
| `submit`, `submission-alert`  | Action 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.

```ts
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](/docs/forms-react/widgets).

## 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.

<ShadcnFormDemoEmbed config={shadcnContactFormConfig} />

<FormConfigCode config={shadcnContactFormConfig} rootName="shadcnContactFormConfig" />

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

```ts
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](https://github.com/schema-engine/schema-engine/blob/main/registry/README.md) 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.

```json
{
	"$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](/docs/layout/grid-and-placement#placing-fields-in-the-grid). View chrome belongs to `view`, not to a step or
element; see [View recipes](/docs/forms-react/layouts).
