Field Schema
Field schema describes one form input.
Fields may be written as simple strings or full objects. Use strings for quick defaults and objects when you need labels, types, validation, options, visibility, adapters, or styling hooks.
String field
schemas/users/user-form.schema.ts
TS
export const simpleFormSchema = {
version: "1.0.0",
resource: "users",
form: {
fields: ["name", "email", "status"]
}
} as const;Object field
schemas/users/user-fields.ts
TS
export const fieldSchema = {
name: "email",
label: "Email",
type: "email",
required: true,
placeholder: "ava@example.com",
helperText: "Use a work email address.",
validator: "users.email"
} as const;Field properties
| Property | Type | Purpose |
|---|---|---|
name | string | Form value key or path. |
label | string | Field label. |
type | string | Field type. |
valueFrom | string | Source path for edit/detail mapping. |
editValueMode | "fromRow" | "empty" | "default" | "hidden" | Edit value behavior. |
createValueMode | "empty" | "default" | "hidden" | Create value behavior. |
defaultValue | unknown | Default value. |
hidden | boolean | Hides the field. |
disabled | boolean | Disables interaction. |
readonly | boolean | Makes field readonly. |
placeholder | string | Placeholder text. |
helperText | string | Help text. |
component | string | Registry component key. |
adapter | string | Field adapter key. |
validator | string | Registry validator key. |
required | boolean | Required flag for UI validation. |
min | number | Minimum numeric value. |
max | number | Maximum numeric value. |
minLength | number | Minimum text length. |
maxLength | number | Maximum text length. |
pattern | string | Pattern string. |
validationMessage | string | Validation message. |
transformer | string | Registry transformer key. |
computed | string | Registry computed value key. |
computedFrom | string | string[] | Source field dependencies for computed values. |
visibleWhen | object | Conditional visibility. |
options | array | Static options. |
optionsEndpoint | string | Endpoint for dynamic options. |
optionsDataPath | string | Response path for options. |
optionLoader | string | Registry option loader key. |
optionLabelKey | string | Label key in option response rows. |
optionValueKey | string | Value key in option response rows. |
className | string | Styling hook. |
Supported field types
TXT
text
email
password
number
textarea
select
multiselect
checkbox
checkbox-group
radio
radio-group
switch
date
datetime
time
file
image
hidden
color
range
json
code
richtext
markdown
tags
combobox
autocomplete
customBoolean and option controls
Use switch for toggle, on-off, and slide controls. Use checkbox for a normal checkbox. Use checkbox-group for multiple selections from options. Use radio or radio-group for single selection from options. Do not use checkbox-toggle; it is not an official field type in the current source.
Static options
schemas/users/user-fields.ts
TS
export const statusField = {
name: "status",
label: "Status",
type: "select",
options: [
{ label: "Active", value: "active" },
{ label: "Suspended", value: "suspended" }
]
} as const;Registry options
schemas/users/user-fields.ts
TS
export const roleField = {
name: "roleId",
label: "Role",
type: "select",
optionLoader: "roles.options"
} as const;Conditional visibility
schemas/users/user-fields.ts
TS
export const suspendedReasonField = {
name: "suspendedReason",
label: "Suspension reason",
type: "textarea",
visibleWhen: {
key: "status",
operator: "equals",
value: "suspended"
}
} as const;Backend responsibility
Field validation improves UX. The backend must still validate every submitted value.