Standards Docs
Concepts

Attributes

The attribute primitives available in standards and their chainable modifiers.

Each attribute is a typed field on an object. You build it from a primitive function — text, relation, status, and so on — then chain modifiers before passing it to .attribute().

// @noverify
import { object, text, number, select, relation } from "@stndrds/schema";

const DEAL = object({ name: "deals", label: "Deal" })
  .labelExpression("{{ name }}")
  .attribute(text({ name: "name", label: "Name" }).required())
  .attribute(number({ name: "amount", label: "Amount" }))
  .attribute(
    select({ name: "currency", label: "Currency" })
      .options([
        { id: "eur", label: "EUR", value: "EUR", color: "blue" },
        { id: "usd", label: "USD", value: "USD", color: "green" },
      ])
  )
  .attribute(relation({ name: "company", label: "Company" }).to("companies").many());

Breaking in vNEXT: builders now default to system: true. The .system() modifier has been removed — anything declared in code is automatically system. Call .runtime() only inside tests, seeds, and fixtures to opt out.

Primitives

PrimitiveUse caseExample
textSingle-line stringstext({ name: "name", label: "Name" }).required()
textareaMulti-line stringstextarea({ name: "notes", label: "Notes" })
richtextRich text editor (blocks)richtext({ name: "body", label: "Body" })
numberNumeric valuesnumber({ name: "age", label: "Age" })
checkboxBooleanscheckbox({ name: "active", label: "Active" })
dateDates and timestampsdate({ name: "closedAt", label: "Closed" })
phoneE.164 phone numbersphone({ name: "phone", label: "Phone" })
currencyMonetary amountscurrency({ name: "price", label: "Price" })
statusWorkflow status with groupsstatus({ name: "stage", label: "Stage" }).options([...])
selectOne value from a fixed setselect({ name: "kind", label: "Kind" }).options([...])
multiselectMany values from a fixed setmultiselect({ name: "tags", label: "Tags" }).options([...])
locationAddress / coordinateslocation({ name: "address", label: "Address" })
fileFile attachmentsfile({ name: "avatar", label: "Avatar" })
userReference to an actoruser({ name: "ownedBy", label: "Owner" })
relationForeign-key edge to another objectrelation({ name: "company", label: "Company" }).to("companies").many()
documentDocument referencedocument({ name: "contract", label: "Contract" })
ratingRating scalerating({ name: "score", label: "Score" })
formulaComputed read-only valueformula({ name: "fullName", label: "Full name" })
rollupAggregate across a relationrollup({ name: "totalAmount", label: "Total" })

Common chainable modifiers

ModifierEffect
.required()Marks the attribute as required; validates presence on write
.optional()Explicitly marks the attribute as nullable (default for most primitives)
.runtime()Opt out of the default system: true (advanced — tests, seeds, fixtures only)
.icon(name)Attaches a Lucide icon to the attribute in the UI
.description(s)Admin tooltip shown in the attribute editor

.required() is a schema-level rule enforced by the runtime validator. Your database adapter must separately configure NOT NULL constraints to guarantee hard enforcement at the storage layer.

On this page