FieldView
Defined in: packages/schema/src/view-field.ts:6
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:10
The field’s name.
readonlyprops:FieldViewModel={}
Defined in: packages/schema/src/view-field.ts:12
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:90
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>
decimals()
Section titled “decimals()”decimals(
decimals):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:72
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):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:40
How the value shows: badge for statuses, code in monospace, percent with a % sign; 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.
Parameters
Section titled “Parameters”format
Section titled “format”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:24
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:98
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:16
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:57
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:48
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>
prefix()
Section titled “prefix()”prefix(
prefix):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:62
Text before a number wherever it is shown, such as a currency: .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:67
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:82
A hex colour per enum value that fills its badge, such as { a: '#00a651' }; values left out keep their tone.
Parameters
Section titled “Parameters”colors
Section titled “colors”{ readonly [P in string]?: 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:77
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>
when()
Section titled “when()”when(
when):FieldView<N,V>
Defined in: packages/schema/src/view-field.ts:32
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:107
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 }). Without that plugin, or when the field type 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>