FieldView
Defined in: packages/schema/src/view-field.ts:9
How a view shows one field, as .fields((r) => ...) hands it out: each hint returns a new field view.
Type Parameters
Section titled “Type Parameters”N extends string = string
V = unknown
Properties
Section titled “Properties”
readonlyname:N
Defined in: packages/schema/src/view-field.ts:13
The field’s name.
readonlyprops:FieldViewModel={}
Defined in: packages/schema/src/view-field.ts:15
The hints given so far.
Methods
Section titled “Methods”badgeShape()
Section titled “badgeShape()”badgeShape(
badgeShape):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:136
arrow draws the field’s badges as arrows pointing right, as on a rating scale such as the EU energy label.
Parameters
Section titled “Parameters”badgeShape
Section titled “badgeShape”"arrow"
Returns
Section titled “Returns”FieldView<N, V>
confirm()
Section titled “confirm()”confirm(
question):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:53
Asks question before a person changes the value in a form or a list cell, such as a flag that is easy to set by
mistake: once as the value first moves away from the saved one, not on every key. Cancelling keeps the value. See
Confirming a change.
Parameters
Section titled “Parameters”question
Section titled “question”string
Returns
Section titled “Returns”FieldView<N, V>
currency()
Section titled “currency()”currency(
currency):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:99
The ISO 4217 code of the currency a decimal is an amount of, such as .currency('EUR'): lists show it as money in it.
Parameters
Section titled “Parameters”currency
Section titled “currency”string
Returns
Section titled “Returns”FieldView<N, V>
decimals()
Section titled “decimals()”decimals(
decimals):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:110
How many decimals a number shows wherever it is shown.
Parameters
Section titled “Parameters”decimals
Section titled “decimals”number
Returns
Section titled “Returns”FieldView<N, V>
format()
Section titled “format()”format(
format,o?):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:64
How the value shows: badge for statuses, code in monospace, percent with a % sign, signed with its sign, green
above zero and red below; for a text field, email, phone and url as a mail, call or open link, edited with an
email, phone or address keyboard on a mobile screen. text gives a url link the text it shows instead of the
address, fixed or with {{field}} placeholders from the record: .format('url', { text: '{{title}}' }).
Parameters
Section titled “Parameters”format
Section titled “format”string
Returns
Section titled “Returns”FieldView<N, V>
help()
Section titled “help()”help(
help,o?):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:27
A line under the field on the record page and in forms; when: 'editing' shows it only while the record is edited,
not on its read view (the view’s .helpWhen(...) when omitted).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”FieldView<N, V>
icon()
Section titled “icon()”icon(
icon):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:144
An icon before the value on a card’s meta row and above it in a section of key facts, by the names actions take,
such as ruler.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”FieldView<N, V>
label()
Section titled “label()”label(
label):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:19
What the field is called, instead of its name in words.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”FieldView<N, V>
markdown()
Section titled “markdown()”markdown():
FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:89
Markdown, such as notes: forms edit its source with a Write and Preview switch, and the record page, a page’s field blocks and a card’s subtitle show it rendered, raw HTML shown as text and links opening in a new tab; the list’s table shows its text on one line. Only a text field takes it.
Returns
Section titled “Returns”FieldView<N, V>
multiline()
Section titled “multiline()”multiline():
FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:80
A text of several lines, such as a description: forms edit it in a box that grows with the text, and the record page and cards keep its line breaks. Only a text field takes it.
Returns
Section titled “Returns”FieldView<N, V>
notOnCreate()
Section titled “notOnCreate()”notOnCreate():
FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:44
Leaves the field off the create form, for one that makes sense only once the record exists, such as a choice among records added after it; the create leaves it empty or to its default, and the record page shows it as usual. The server stops at startup on a field a create needs: not optional and with no default.
Returns
Section titled “Returns”FieldView<N, V>
prefix()
Section titled “prefix()”prefix(
prefix):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:94
Text before a number wherever it is shown, such as a currency sign: .prefix('€').
Parameters
Section titled “Parameters”prefix
Section titled “prefix”string
Returns
Section titled “Returns”FieldView<N, V>
suffix()
Section titled “suffix()”suffix(
suffix):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:105
Text after a number wherever it is shown, such as a unit: .suffix(' m²').
Parameters
Section titled “Parameters”suffix
Section titled “suffix”string
Returns
Section titled “Returns”FieldView<N, V>
valueColors()
Section titled “valueColors()”valueColors(
colors):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:123
A badge tone (neutral, blue, green, amber, red or violet) or a hex colour that fills the badge, per enum
value, such as { paid: 'green', a: '#00a651' }; values left out are neutral.
Parameters
Section titled “Parameters”colors
Section titled “colors”{ readonly [P in string]?: “neutral” | “blue” | “green” | “amber” | “red” | “violet” | string & {} }
Returns
Section titled “Returns”FieldView<N, V>
valueLabels()
Section titled “valueLabels()”valueLabels(
labels):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:115
Labels for an enum’s values, such as { co_signer: 'Co-signer' }; values left out read as themselves in words.
Parameters
Section titled “Parameters”labels
Section titled “labels”{ readonly [P in string]?: string }
Returns
Section titled “Returns”FieldView<N, V>
waitingValues()
Section titled “waitingValues()”waitingValues(
values):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:131
Enum values that mark a wait rather than work, such as .waitingValues(['queued', 'blocked']): a Timeline draws them striped.
Parameters
Section titled “Parameters”values
Section titled “values”readonly Extract<V, string>[]
Returns
Section titled “Returns”FieldView<N, V>
when()
Section titled “when()”when(
when):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:35
When the field shows on the record page: editing only on its form and the create form, reading only on its read
view and locked form; always when omitted. Its lists, cards and filters show it either way.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”FieldView<N, V>
widget()
Section titled “widget()”widget(
name,props?):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:155
Shows and edits the field with the field type a plugin registers under name (definePlugin({ fields })), given
props, such as r.score.widget('rating', { max: 5 }), or with the built-in members, which picks an
organization’s members into a JSON array of user ids (see
Members). Without that field type, or when it does not show
this field’s storage type, the field shows as it would without it.
Parameters
Section titled “Parameters”string
props?
Section titled “props?”Record<string, JsonValue>
Returns
Section titled “Returns”FieldView<N, V>