CodelabDocs
Core concepts

State

Values, props, stores, and bindings.

Values and props

A prop supplies a value to an element or component. A literal holds the value directly: "Hello", 42, true.

Stores

A store declares fields and actions. Its scope is an app, page, or component.

{{stores.user.name}} reads the name value from the user store.

Expressions

An expression computes a value from the current context.

{{stores.user.name}}
{{props.title}}
{{repeat.item}}
{{hooks.rsvpForm.values.email}}
{{session.user.email}}
{{page.search.eventId}}

Mixed text interpolates: Hello {{stores.user.name}}.

Bindings

A binding references a target. A component binding can supply props. A function binding can supply arguments.

Component: { componentId, instanceProps }
Function:  { functionId, instanceParams }
Element:   { elementId }

Component props

The component interface declares the inputs. The instance supplies the values. Expressions inside the component read {{props.<name>}}.

Route and session values

page supplies route values. session supplies the current viewer's session.

External data

A useQuery hook fetches data. Expressions read its outputs through {{hooks.<alias>.<path>}}.

Fields, interfaces, and schemas

A field has a name and type. An interface is a list of fields. A schema names an interface for reuse within an app.

Types

Types describe the values a field accepts.

TypeKindShapeDescription
Type.Texttext{ kind, flavor? }String. flavor is "inline" or "rich".
Type.Numbernumber{ kind }Number.
Type.Booleanboolean{ kind }Boolean.
Type.Datedate{ kind }Date.
Type.Filefile{ kind, accept? }File value { fileId, name?, format? }. accept is a MIME glob (image/*, video/*).
Type.Objectobject{ kind, fields }Nested record. fields is a field list. Holds a value of a shape.
Type.Arrayarray{ kind, item }List. item is any nested type.
Type.Refref{ kind, refId }An app schema.
Type.Andand{ kind, operands }Intersection. Last operand wins on the same field name.
Type.Oror{ kind, operands }Type-level union (string | string[] | void). No stored discriminator.
Type.OneOfoneof{ kind } plus field discriminator / variantsForm toggle-group: named variants, each with fields. Distinct from or.
Type.Elementelement{ kind }{ elementId }. A ref to a node in the tree.
Type.Componentcomponent{ kind }{ componentId, instanceProps? }.
Type.Functionfunction{ kind, params?, returns?, async?, identity? }A callable. The value is a function call { functionId, instanceParams?, when? }.
Type.RenderProprenderprop{ kind, params }The element's children are the callback body; declared params bind as {{render.<name>}}. Return is rendered, not consumed as a value.
Type.Voidvoid{ kind }Nothing. Only meaningful as a callable's returns. Distinct from omitted returns (undeclared).
Type.Interfaceinterface{ kind }The value is a field list (a shape). Object holds a value of a shape; Interface holds the shape.

On this page