[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationField notes

Field notes

Help lines, pending changes, module defaults and read-only values under a form field's control.

A field row says more than its label and its control. Under the control, the form draws short notes: a help line the module writes, the value a pending change replaces, the module's default, or why a value cannot be edited here. Declare them on the field; the form decides when each shows.

src/pages/workspace-settings.ts ts
fields: [
  {
    id: "retention",
    label: "Keep history for",
    type: new DefaultDataTypes.NumberType({ min: 1, max: 365 }),
    defaultValue: 30,
    offersDefault: true,
    hint: "Older entries are deleted every night.",
  },
  {
    id: "email",
    label: "Email",
    type: new DefaultDataTypes.EmailType(),
    readonly: {
      badge: { label: "Verified", tone: "success" },
      link: { label: "Change in Security", to: "/settings/user/security" },
    },
  },
],

Help line: hint

hint (an i18n key or a literal) is a grey line under the control. It describes the control to assistive technology too (aria-describedby). While the field has an error, the error takes its place.

hint differs from description, which sits under the label: use description for what the field is, hint for what happens with the value.

A read-only field (disabled or readonly) shows no hint: there is no control to describe. A form where nothing can be changed (a record's details) shows no description either, since "Left empty, the default rate applies" says nothing to someone reading the value.

Pending change

While a field holds a value it did not load with (or last save), a "Changed · was 30" line shows under it, worded by the field's type ("was empty" for a field that had none). A relation names the row it loaded with by its label, from the row the server joined, rather than by its id. Values that do not fit a line, such as a password, code or rich text, say "Changed" alone. It needs nothing declared and shows only while a change waits for its save: not in an instant form, nor in an action form.

Form Form
Connecting to the DMS preview…
Connecting DMS 0.25.8 5 options set

In the example above, the record loads 90 days for Keep history for, and the module default is 30. Change it to 60: the note shows the pending change and the 90 it replaces, and offers the default. Billing email is read-only, with a Verified badge and a link to the page that changes it.

Module default

defaultValue is the value a new record starts with. On a setting, it is also the module's default: declare offersDefault: true, and while the field holds something else it shows "Module default: 30 · Use default"; Use default puts the default back (as an unsaved change). A disabled field offers no Use default.

Without offersDefault, the field shows no such note: a record form, such as the one a table view generates from its columns, edits a record whose values owe nothing to the column's initial value, so straying from it is not news.

Read-only values: readonly

readonly: true shows the value with its type's display, not an input: it is not edited, and not marked required. To say why, or where it is changed, give an object:

PropertyTypePurpose
badge{ label: string; tone: Tone }A pill beside the value ("Verified", "Managed by SSO").
link{ label: string; to: string }A link to where the value is changed.

label is an i18n key or a literal; tone is one of the seven tones. Unlike disabled, which greys an input out, readonly presents a value the user is not meant to edit on this form.

On a create form

A create form (kind: "create") leaves out a read-only field (disabled or readonly) that holds nothing yet: a number, a date or a total the server sets once the record exists would only read —. The field shows as soon as it holds a value (a defaultValue, one a rule computes). To keep it in place, empty, set showEmptyOnCreate: true on the field (or on its @Column). To leave a column out of the create form whatever it holds, give it readonlyBehavior: { new: "hidden" }.