You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quick reference for choosing the right field type from the available options.
Two spellings: Field.* factory or object literal
The tables below give the object-literal spelling. Real apps overwhelmingly
use the equivalent Field.* factory (@objectstack/spec) — same schema, plus
per-helper JSDoc and inference (Field.lookup's const generic is what lets
defineSeed() type its reference values). A helper exists for every type below
except a few authored as literals (tags, progress, repeater, vector).
Config columns list only real FieldSchema keys. Per-type display knobs
beyond these do not exist — an unknown field key is REFUSED at parse
(unrecognized_keys), so don't invent theme, rows, or
fileAttachmentConfig. Source of truth:
node_modules/@objectstack/spec/src/data/field.zod.ts.
Text & Content
Type
When to Use
Config
text
Single-line strings (names, codes, titles)
maxLength, minLength, defaultValue
textarea
Multi-line plain text (notes, descriptions)
maxLength, minLength
email
Email addresses — built-in format validation
required, unique
url
Web URLs — built-in format validation
required
phone
Phone numbers
format
password
⚠️ Masked-on-read input. On a generic object the value is stored PLAINTEXT at rest (never hashed — one-way hashing applies only inside the auth subsystem's own identity tables). Prefer secret for credentials; a generic password field triggers a build warning
minLength, maxLength
secret
Reversible encrypted-at-rest credential (DB password, API key, token) — encrypted on write via ICryptoProvider, masked on read, fail-closed (ADR-0100). The recommended type for credentials
—
markdown
Markdown-formatted content
maxLength
html
Raw HTML content
maxLength
richtext
WYSIWYG rich text editor
maxLength
Numbers
Type
When to Use
Config
number
Generic numeric value
min, max, precision, scale
currency
Monetary amounts
currencyConfig (currencyMode, defaultCurrency)
percent
Percentage values (0-100)
min, max, precision
Date & Time
Type
When to Use
Config
date
Date only (no time component)
defaultValue
datetime
Full date + time
defaultValue
time
Time only (no date component)
defaultValue, format
Logic
Type
When to Use
Config
boolean
Standard checkbox
defaultValue
toggle
Toggle switch (distinct UI from checkbox)
defaultValue
Selection
Type
When to Use
Config
select
Single-choice dropdown
options (value, label, color, default)
multiselect
Tag-style multi-choice
options, max
radio
Radio button group (fewer choices, always visible)
options
checkboxes
Checkbox group
options
Critical: Every option must have lowercase value and human-readable label.
Stored as JSON on the parent row — no separate table / FK:
Type
When to Use
composite
Single embedded JSON object, untyped — a field declares no sub-fields (fields / subFields are refused)
repeater
Embedded JSON array, untyped — no sub-fields or columns; a typed list is a child object (master_detail, inlineEdit: 'grid')
record
Name-keyed map of embedded sub-objects (insertion order = display order; ADR-0007)
Calculated
Type
When to Use
Config
formula
Computed from an expression referencing other fields — virtual: not aggregatable, a dataset measure needs a stored field (objectstack-ui → Dashboards → Dataset-Bound Widgets)
expression (CEL, record. prefixes), returnType ('number' | 'text' | 'boolean' | 'date' | 'currency'); 'currency' carries its own currencyConfig
Auto-incrementing display format ({0000} counter + optional date / {field} tokens, resets per scope)
format (shorthand) / autonumberFormat (canonical) — e.g., "CASE-{0000}", "AD{YYYYMMDD}{0000}"
Enhanced Types
Type
When to Use
Config
location
Geographic coordinates (lat/lng)
—
address
Structured address (street, city, country)
—
code
Syntax-highlighted code editor
language
json
JSON data (untyped escape hatch)
— (validate with a json_schema validation rule on the object)
color
Color picker
—
rating
Star/heart rating
max (default 5)
slider
Numeric slider
min, max, step
signature
Digital signature pad
—
qrcode
QR code / barcode
—
progress
Progress bar
min, max
tags
Free-form tag input
—
vector
AI/ML embeddings (semantic search, RAG)
dimensions (flat sibling, e.g. 1536)
Common Field Configurations
Text with Max Length
{type: 'text',maxLength: 255,required: true,}
Email with Uniqueness
{type: 'email',required: true,// State the scope (ADR-0120): 'organization' = one holder per organization// (NULL-safe), 'global' = one across the whole installation. Bare `true` at// field level still means 'organization' and stays valid.unique: 'organization',}
Currency
{type: 'currency',currencyConfig: {currencyMode: 'fixed',defaultCurrency: 'USD'},// ISO 4217}// per record: { currencyMode: 'record', currencyField: 'currency_code' }
Currency resolution. The value is a bare number in every mode, never
{ value, currency }. Shown: 'fixed', defaultCurrency; 'dynamic'
(default), the tenant localization.currency, else a plain number (never
$); 'record', each record's code in the text field currencyField
names (by convention currency_code), with valueDomain: 'iso_4217_currency'. A
dataset measure's own currency wins over a 'dynamic' field; over a 'fixed' one
it may only restate the code, else DATASET_INVALID (objectstack-ui →
Dashboards). A 'fixed' code is not judged against the tenant's. Switched a
stored field to 'record'? Backfill: os migrate record-currency-codes.
import{F}from'@objectstack/spec';consttotal={type: 'formula',expression: F`record.amount * record.tax_rate`,returnType: 'number',// see the Calculated table};
The format is literal text interleaved with {...} tokens:
Token
Renders
Example
{0000}
The counter, zero-padded to that many digits (minimum width). At most ONE slot.
CASE-{0000} → CASE-0042
{YYYY}{YY}{MM}{DD}{YYYYMMDD}
Generation date in the request's business timezone
AD{YYYYMMDD}{0000} → AD202606170001
{field_name}
The value of another field on the same record
{plan_no}{000} → PLAN-001001
The counter resets per "scope" — everything rendered before the {0000} slot. So AD{YYYYMMDD}{0000} restarts each day, {section}{island_zone}{000} counts per group, {plan_no}{000} counts per parent — no separate reset config. A fixed-prefix format (CASE-{0000}) has an empty scope → one global counter.
Rules — get these wrong and records mis-number silently or fail to save:
Every {field} you interpolate must be required: true and set before the record is created. An empty interpolated field makes the record number generation throw (the compile lint flags a non-existent field as an error, an optional one as a warning).
Put a delimiter between adjacent variable tokens — {section}-{zone}{000}, not {section}{zone}{000}. Without one, ('AB','C') and ('A','BC') both render prefix ABC and share a counter (to keep numbers unique). The literal separator keeps distinct groups apart.
Pad width is a MINIMUM, not a cap.{000} → 001…999, then 1000 (it grows, never wraps). Size it for readability, not as a ceiling.
Only known tokens are interpolated. Date tokens are case-sensitive — {yyyy} parses as a {field} reference and renders empty (rule 1 applies). Only a spelling no field could have — { YYYY }, {YYYY-MM} — is emitted literally.
There is novectorConfig block — an authored vectorConfig is refused at
parse. dimensions is the flat field-level key.
Incorrect vs Correct
❌ Incorrect — Autonumber interpolating an optional / adjacent field
{plan_no: {type: 'text'},// ❌ not required — empty value throws at createorder_no: {type: 'autonumber',format: '{section}{plan_no}{000}'},// ❌ no delimiter}
✅ Correct — Required field + delimiter between variable tokens
{plan_no: {type: 'text',required: true},// ✅ always set before generationorder_no: {type: 'autonumber',format: '{section}-{plan_no}-{000}'},// ✅ delimited}