Widget fields reference
A widget (a theme's fields.json, a site block, or a built-in component) declares its editable props as a JSON-Schema subset. The same schema drives three things at once: the visual editor's Inspector form, AI generation, and validation — a schema that uses a format or keyword outside this page is rejected on save.
This page is generated at build time from the platform's field contract (revision 19d95918), so it always matches what the platform accepts.
Shape
{
"$schema": "https://docs.onivos.com/schemas/website-widget-fields.schema.json",
"type": "object",
"properties": {
"title": { "type": "string", "title": "Title", "group": "Content" },
"cta": { "type": "object", "format": "link", "title": "Button" },
"plans": {
"type": "array",
"title": "Plans",
"items": {
"type": "object",
"properties": {
"name": { "type": "string", "title": "Plan" },
"price": { "type": "string", "title": "Price", "displayWidth": "half" }
}
}
}
},
"required": ["title"]
}Point $schema at the URL above to get autocomplete and validation in your editor while building themes with the CLI.
- A
type: "object"field withpropertiesrenders as a nested form; with aformat(likelinkorfont) it renders that composite editor instead. - A
type: "array"whoseitemsis an object renders as a repeater (drag-reorder, duplicate, collapse); withitems.enumit renders as a multi-select. - A plain
enumrenders as a choice — values that are all alignment keywords auto-upgrade to the alignment toggle.
Field types (format)
format picks the editor when type alone is ambiguous. Live-option formats (menu, page, article, record) get their choices injected by the builder — never list options in the schema.
| format | on type | stored value | notes | example |
|---|---|---|---|---|
textarea | string | string | Plain multi-line text. | Every plan includes onboarding. |
richtext | string | HTML string | WYSIWYG-edited HTML (sanitized on render). | <p>We ship <strong>fast</strong>.</p> |
code | string | string | Source code in a CodeMirror editor. Extra keywords: language. | <div class="badge">New</div> |
unit | string | number | string ('16px') | A number with a CSS unit; min+max unlock a slider. Extra keywords: units, min, max, step. | 16px |
multiselect | array | string[] | Pick several from a fixed option list (options on `items.enum`). | ["seo","ads"] |
tags | array | string[] | Free-form tag list with optional suggestions. Extra keywords: suggestions. | ["sale","featured"] |
color | string | string (CSS color) | A CSS color value. | #7c3aed |
gradient | string | string (CSS gradient) | A CSS gradient value. | linear-gradient(90deg, #7c3aed, #db2777) |
font | object | object | Font family/size/weight as an object; the widget Liquid reads sub-props. | {"family":"'Inter', sans-serif","size":"18px","weight":"600"} |
fontFamily | string | string (CSS font stack) | One family picked from the Google Fonts catalog (./web-fonts), stored as a CSS stack. Self-hosted at publish — see docs/plans/web-fonts.md. | 'Inter', system-ui, sans-serif |
alignment | string | string (left|center|right|justify) | Segmented icon toggle. A plain enum whose values are all alignment keywords renders as this automatically. | center |
border | string | string (CSS border shorthand) | Width/style/color as one CSS shorthand string. | 1px solid #e5e7eb |
spacing | string | string (CSS box shorthand) | Four-side margin/padding editor emitting a CSS shorthand. | 16px 24px |
corners | string | string (CSS radius shorthand) | Per-corner radius editor emitting a CSS shorthand. | 8px 8px 0 0 |
icon | string | string (PrimeIcons name) | Icon picker over the PrimeIcons set. | pi-bolt |
image | string | URL string | Image URL with a media-library picker. | https://cdn.example.com/hero.jpg |
video | string | URL or embed-HTML string | Alias of embed. | https://www.youtube.com/watch?v=xyz |
embed | string | URL or embed-HTML string | External media by URL or pasted embed snippet. | https://www.youtube.com/watch?v=xyz |
link | object | { href, target?, rel? } | Internal-page or external link; the widget Liquid reads sub-props (props.cta.href). | {"href":"/pricing","target":"_self"} |
date | string | ISO date string | Date picker. | 2026-08-01 |
datetime | string | ISO datetime string | Date + time picker. | 2026-08-01T18:00:00Z |
url | string | URL string | Text input with URL keyboard/validation. | https://onivos.com |
email | string | string | Text input with email keyboard/validation. | [email protected] |
phone | string | string | Text input with tel keyboard. | +84 28 1234 5678 |
map | object | object (string→string) | Free-form key→value editor. | {"utm_source":"newsletter"} |
json | object | array | string | any JSON | Raw JSON in a code editor. | {"columns":3} |
menu | string | menu id string | Picks one of the site's navigation menus; the builder injects live options. | 73020331450368001 |
global | string | global module handle | Picks one of the site's reusable global modules by handle; the builder injects live options. | promo-banner |
page | string | page id string | Picks one of the site's pages; the builder injects live options. | 73020331450368002 |
article | string | article id string | Picks one of the site's blog articles; the builder injects live options. | 73020331450368003 |
record | string | record id string | Picks a data-object record (declare the object with the `object` keyword); the builder injects live options. Extra keywords: object. | 73020331450368004 |
form | string | form id string | Picks one of the site's forms; the builder injects live options. | 73020331450368005 |
product | string | product id string | Picks a commerce product; the builder injects live options. | 73020331450368006 |
crmobject-property | string | field key string | Picks a FIELD (not a record) of a data object — declare the object with the `object` keyword; the builder injects live options. Extra keywords: object. | title |
Without a format, the bare type decides the editor:
| type | renders as |
|---|---|
string | text |
integer | number |
number | number |
boolean | boolean |
object | object |
array | multiselect |
Keywords
| keyword | meaning |
|---|---|
type | JSON-Schema type; defaults to "string" when omitted. |
title | Label shown above the input. |
format | Selects the renderer (a FORMATS key) when `type` alone is ambiguous. |
default | Default value — also drives the per-field reset affordance and the unit slider rest value. |
enum | Choice options: ['a','b'] or [{label,value}]. On an array field, put it on `items.enum` (multiselect). |
display | Choice presentation: select | buttons | radio | checkbox. Small string enums (≤4) default to buttons. |
group | Buckets the field into a collapsible section of the form. |
displayWidth | 'half' → two fields share a row. |
required | Marks the field required (asterisk). Root-level `required: []` array works too. |
help | Helper text under the input (alias: inlineHelp). |
inlineHelp | Alias of help. |
visibility | { field, operator?, value? } — show only when a sibling matches (operator: eq (default) | neq | in | truthy) — OR a composite { all: [rules] } / { any: [rules] } for AND/OR of nested rules. |
placeholder | Input placeholder. |
units | format:unit — allowed unit list, e.g. ['px','rem']. First entry is the default. |
min | format:unit — slider lower bound (with max, unlocks the slider). For a plain number field use `minimum`. |
max | format:unit — slider upper bound. |
step | format:unit — slider increment. |
minimum | JSON-Schema numeric value lower bound (AI generation honors it; the editor does not). |
maximum | JSON-Schema numeric value upper bound. |
minLength | JSON-Schema string length lower bound. |
maxLength | JSON-Schema string length upper bound. |
pattern | JSON-Schema regex the string value must match; the editor validates it live (AI generation honors it too). |
patternMessage | The error message shown when `pattern` fails (falls back to a generic one). |
locked | Developer-set value a content editor cannot change — the field renders read-only with a lock hint. |
minItems | type:array repeater — minimum item count (the editor blocks removing below it; AI honors it). |
maxItems | type:array repeater — maximum item count (the editor blocks Add above it; AI honors it). |
object | format:record — key of the data object to pull records from. |
suggestions | format:tags — autocomplete suggestions. |
language | format:code — editor language (default 'html'). |
properties | type:object — nested field map (rendered as a nested form). |
items | type:array — item schema: `{enum}` → multiselect, `{type:"object",properties}` → repeater. |
Style fields
A CLI widget may include a styles object group in its fields.json; it becomes the widget's Style tab schema (otherwise every widget gets the standard spacing / background / typography / border / effects form). Style values live on the page node, not in your widget's props, and only whitelisted CSS properties are emitted.