Skip to content

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.

N extends string = string

V = unknown

readonly name: N

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

The field’s name.


readonly props: FieldViewModel = {}

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

The hints given so far.

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.

"arrow"

FieldView<N, V>


decimals(decimals): FieldView<N, V>

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

How many decimals a number shows wherever it is shown.

number

FieldView<N, V>


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.

FieldFormat

FieldView<N, V>


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

string

HelpWhen

FieldView<N, V>


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.

string

FieldView<N, V>


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.

string

FieldView<N, V>


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.

FieldView<N, V>


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.

FieldView<N, V>


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

string

FieldView<N, V>


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

string

FieldView<N, V>


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.

{ readonly [P in string]?: string }

FieldView<N, V>


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.

{ readonly [P in string]?: string }

FieldView<N, V>


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.

ShowWhen

FieldView<N, V>


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.

string

Record<string, JsonValue>

FieldView<N, V>