Skip to content

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.

N extends string = string

V = unknown

readonly name: N

Defined in: packages/schema/src/view-field.ts:13

The field’s name.


readonly props: FieldViewModel = {}

Defined in: packages/schema/src/view-field.ts:15

The hints given so far.

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.

"arrow"

FieldView<N, V>


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.

string

FieldView<N, V>


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.

string

FieldView<N, V>


decimals(decimals): FieldView<N, V>

Defined in: packages/schema/src/view-field.ts:110

How many decimals a number shows wherever it is shown.

number

FieldView<N, V>


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}}' }).

FieldFormat

string

FieldView<N, V>


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).

string

HelpWhen

FieldView<N, V>


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.

string

FieldView<N, V>


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.

string

FieldView<N, V>


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.

FieldView<N, V>


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.

FieldView<N, V>


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.

FieldView<N, V>


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('€').

string

FieldView<N, V>


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²').

string

FieldView<N, V>


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.

{ readonly [P in string]?: “neutral” | “blue” | “green” | “amber” | “red” | “violet” | string & {} }

FieldView<N, V>


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.

{ readonly [P in string]?: string }

FieldView<N, V>


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.

readonly Extract<V, string>[]

FieldView<N, V>


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.

ShowWhen

FieldView<N, V>


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.

string

Record<string, JsonValue>

FieldView<N, V>