Validation
Zod validators, or pure-JSON rules with custom messages.
A field can be validated two ways. Both surface errors the way ui.errors
dictates (inline / toast / popup).
Zod (validation)
Attach any Zod validator to a field. This is the most expressive option and integrates directly with React Hook Form's resolver:
import { z } from 'zod'
{ name: 'email', type: 'email', label: 'Email', validation: z.string().email() }
{ name: 'age', type: 'number', label: 'Age', validation: z.number().min(18).max(99) }JSON rules (rules)
When you'd rather not import Zod for a field — or you're authoring the schema as data —
declare rules. Pure JSON, with a custom error message per field:
{
"name": "age",
"type": "number",
"label": "Age",
"rules": { "required": true, "min": 18, "max": 99, "message": "Enter an age 18–99" }
}Supported keys:
| Key | Applies to | Meaning |
|---|---|---|
required | any | value must be present |
email | text/email | must be a valid email |
pattern | text | regex source string, e.g. "^[0-9]+$" |
minLength / maxLength | text | string length bounds |
min / max | number | numeric bounds |
message | any | overrides the default text for any failed rule on this field |
If both are present on a field, the Zod validation wins — rules is used only
when validation is absent.