Fields
Field Types
Section titled “Field Types”| Field | Storage | Admin Component |
|---|---|---|
text | text | Input or Textarea (with rows) |
slug | text | Auto-generated from source field |
email | text | Email input |
number | integer / real | Number input |
boolean | integer (0/1) | Toggle switch |
date | text (ISO 8601) | Date picker |
select | text | Select dropdown |
richText | text (JSON AST) | Tiptap editor |
image | text | Image picker with upload/browse |
relation | text (reference ID) | Combobox with search |
array | text (JSON) | Comma-separated input |
json | text (JSON) | Textarea or custom component |
blocks | text (JSON) | Drag-and-drop block editor |
Common Options
Section titled “Common Options”All fields accept these options:
| Option | Type | Description |
|---|---|---|
required | boolean | Validate as non-empty on save |
label | string | Custom label (defaults to humanized field name) |
description | string | Text shown below the label |
defaultValue | varies | Initial value for new documents |
translatable | boolean | Store per-locale in translations table |
indexed | boolean | Add database index |
unique | boolean | Enforce unique values |
condition | { field, value } | Show/hide based on another field |
admin.placeholder | string | Input placeholder text |
admin.rows | number | Textarea height (text fields) |
admin.help | string | Help text below the input |
admin.position | "sidebar" | Place field in sidebar instead of content area |
admin.hidden | boolean | Hide from admin UI |
admin.component | string | Custom admin component |
Blocks
Section titled “Blocks”fields.blocks({ types: { hero: { heading: fields.text({ required: true }), body: fields.text(), ctaLabel: fields.text(), ctaHref: fields.text(), }, text: { heading: fields.text(), content: fields.richText(), }, faq: { heading: fields.text(), items: fields.json({ defaultValue: [], admin: { component: "repeater" }, }), }, },});Block sub-fields support: text, number, boolean, select, richText, image, relation, array.
The repeater component renders JSON arrays as grouped add/remove item cards.
Conditional Fields
Section titled “Conditional Fields”Show/hide fields based on a select or boolean field’s value:
postType: fields.select({ options: ["article", "video", "podcast"],}),videoUrl: fields.text({ condition: { field: "postType", value: "video" },}),The value can be a string, boolean, or array of strings (matches any).
Field-Level Access
Section titled “Field-Level Access”role: fields.select({ options: ["admin", "editor", "viewer"], access: { update: ({ user }) => user?.role === "admin", },}),Fields the user can’t update are silently stripped on save.