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

Field types

Choice cards, segmented and radio selects, boolean cards, repeaters, key-value pairs, secrets, copyable values, code and tags.

The common settings controls are data types or display options of the standard ones: plan cards, a row of segments, an "I accept" box, a list of headers, an API key, a webhook URL to copy, a JSON payload, a list of addresses. Declare them on a field like any other type: they validate on the client and the server, read in tables and read-only forms, and need no Vue. Every class below lives in DefaultDataTypes (@antelopejs/interface-dms/base/data-types); the full catalog is in Data types.

Choices: SelectType({ display })

display decides how a select shows its items:

displayRendersPicks
dropdown (default)A dropdown.one, or several with multiple
cardsA card per option, with its description.one, or several with multiple
segmentedThe options side by side.one
radioA list of radio buttons, each with its description.one
Form Form
Connecting to the DMS preview…
Connecting DMS 0.25.8 6 options set

The example above draws Package as cards, Roof as segments and Monitoring as a card switch. How many cards fit on a row depends on the width the form gets: in a narrow frame they stack.

segmented and radio pick one value: a multiple select asking for either shows cards instead. Cards sit two per row once the field is 480px wide; SelectType({ display: "cards", columns: 3 }) keeps three options on one row instead of wrapping 2 + 1. FormComponents.InputChoiceCards takes the same columns, and so does DmsChoiceCards in a module's own input (:columns="3"). An option (SelectOption) takes label, value, and optionally description (the line cards and radios show), icon and disabled.

ts
{
  id: "plan",
  label: "Plan",
  type: new DefaultDataTypes.SelectType({
    display: "cards",
    items: [
      { label: "Starter", value: "starter", description: "1 workspace, community support" },
      { label: "Team", value: "team", description: "10 workspaces, email support" },
    ],
  }),
  required: true,
},

Booleans: BooleanType({ display })

displayRenders
switch (default)A switch, with label and description beside it.
checkboxA box to tick, with label and description beside it.
cardA bordered card: an icon, a title (label), a text (description) and a switch, for a choice that needs more than a bare switch.

A required boolean shown as a checkbox is an agreement ("I accept the terms"): only ticking it fills it, and the server validates it as true (z.literal(true)). A switch keeps false as a value, so a required switch accepts either. The same holds for a boolean whose inputComponent is FormComponents.InputCheckbox().

ts
{ id: "terms", label: "Terms", required: true,
  type: new DefaultDataTypes.BooleanType({ display: "checkbox", label: "I accept the data processing terms" }) },
{ id: "owner", label: "Ownership",
  type: new DefaultDataTypes.BooleanType({ display: "card", icon: "i-ph-crown",
    label: "Make them a workspace owner", description: "Owners hold every permission and manage billing." }) },

Rows of fields: ArrayType

ArrayType edits a list of objects as a repeater: a row per item, a column per field drawn by its own type's input, a discreet ✕ per row and a "+ Add …" button. Where the field is narrower than 480px (a drawer, a phone), each row stacks its fields instead, each under its column's label, as a small card.

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

The example above lists two roof faces of a house, each with an orientation, a tilt and a panel count. Drag a row by its handle, add a face, or remove one: the repeater keeps between one and four rows. A face you add starts facing south at 35°.

ts
{
  id: "categories",
  label: "Categories",
  type: new DefaultDataTypes.ArrayType({
    of: {
      name: { type: new DefaultDataTypes.StringType(), label: "Name", required: true },
      templates: { type: new DefaultDataTypes.NumberType({ min: 0 }), label: "Templates", defaultValue: 0 },
    },
    sortable: true,
    min: 1,
    max: 5,
    addLabel: "Add a category",
  }),
},
OptionTypePurpose
ofRecord<string, DataType | { type; label?; required?; defaultValue? }>The fields of a row, by key; label heads the column (the key otherwise). Required.
sortablebooleanA ⋮⋮ handle reorders the rows, by drag or with the arrow keys on it.
minnumberFewest rows: a field holding fewer opens with new rows up to min, and ✕ is disabled at min.
maxnumberMost rows: "+ Add …" is hidden at max.
addLabelstringLabel of the add button (i18n key or literal).

The value is the list of objects ([{ name, templates }, …]). Each cell is a form input: an error on categories.2.name turns that cell red, shows under the field and joins the validation summary.

A new row's values: defaultValue

A field of of with a defaultValue holds it in every row the user adds with "+ Add …", and in the rows a field below min opens with; a field without one starts empty. The new row is checked once edited or on submit, never flagged the moment it appears. The rows min creates are the value the field opens with, so the form does not count them as a change to save.

The rows the form itself opens with still come from the field's own defaultValue (a list of row objects) or from the record it loads:

ts
{
  id: "lines",
  type: new DefaultDataTypes.ArrayType({
    of: {
      description: { type: new DefaultDataTypes.StringType(), required: true },
      quantity: { type: new DefaultDataTypes.NumberType({ min: 0 }), defaultValue: 1 },
      unit: {
        type: new DefaultDataTypes.SelectType({ items: [
          { label: "Hour", value: "hour" },
          { label: "Day", value: "day" },
        ] }),
        defaultValue: "hour",
      },
    },
  }),
  defaultValue: [{ description: "", quantity: 1, unit: "hour" }],
},

Name and value pairs: KeyValueType

KeyValueType edits pairs of a name and a value, such as headers, labels or environment variables, on the same repeater, with two columns. The value is an object, a key per pair.

OptionTypePurpose
valueTypeDataTypeType of the values; a text by default.
toggleablebooleanA box per row turns the pair on or off: each value becomes { value, enabled }.
addLabelstringLabel of the add button.
keyLabelstringHeader of the name column ("Name" by default).
valueLabelstringHeader of the value column ("Value" by default).

A value without a name, or a name given twice, is refused under the field.

Secrets: SecretType

SecretType is a secret the module hands to the user: an API key, a webhook signing secret. The input shows it masked but its last four characters (••••f3a9); Show reveals it and the copy button copies it, in the browser.

OptionTypeDefaultPurpose
revealablebooleantrueOffer Show.
copyablebooleantrueOffer the copy button.
rotateUrlstringNoneOffer Rotate…: after a confirmation, the form POSTs to this URL and the field takes the value of its { value } answer. The route stores the new secret itself: the form does not read it as a change to save, and Discard keeps it. Takes {{params.X}} / {{query.X}}, so an edit form names its record (/api/webhooks/{{params.id}}/rotate); Rotate is not offered while one has no value.
placeholderstringNonePlaceholder of an empty secret.
ts
{ id: "webhookSecret", label: "Webhook secret",
  type: new DefaultDataTypes.SecretType({ rotateUrl: "/api/webhooks/rotate" }) },

// on the API controller
@Post("rotate")
rotate() {
  const value = `whsec_${randomBytes(24).toString("hex")}`;
  // …store it
  return { value };
}
Warning

Masking is a display: the value travels as is, to the form and to any table listing the field. Gate the route that serves it (and the table) to the people allowed to read the secret.

A value to copy: StringType({ copyable: true })

A string with copyable: true is shown read-only with a copy button, for a webhook URL, an endpoint or an id. Its filter in a table stays a text input.

Code: CodeType

CodeType stores text edited in a code editor: line numbers, highlighting in the theme's colours, the current line, a status line with the language and Ln/Col, and an autocomplete (Ctrl+Space) merging the language's keywords with the module's suggestions. The editor loads on demand, in its own chunk: until then, and in the server render, the code shows as is.

OptionTypeDefaultPurpose
language"json" | "sql" | "html" | "javascript" | "text"NoneLanguage highlighted. Required.
lineNumbersbooleantrueThe gutter numbering the lines.
minLinesnumberNoneHeight of the editor, in lines, before it grows with its text.
maxLinesnumberNoneLines shown before the editor scrolls.
completions{ label; detail?; icon? }[]NoneSuggestions of the module.
completionsUrlstringNoneGET, fetched once, answering { items } (or a list) of { label, detail?, icon? }: suggestions listed first. Takes {{params.X}} / {{query.X}}; nothing is fetched while one has no value.
placeholderstringNonePlaceholder of an empty editor.

With language: "json", text that does not parse is refused under the field as you type, and by the server.

ts
{ id: "query", label: "Query",
  type: new DefaultDataTypes.CodeType({
    language: "sql",
    minLines: 3,
    completions: [{ label: "invoices", detail: "table", icon: "i-ph-table" }],
    completionsUrl: "/api/database/completions",
  }) },

Tags: TagsType

TagsType is a list of short texts typed as tags: a pill per item. Commas, semicolons and spaces end an item, typed or pasted; duplicates are ignored (addresses compared in lower case).

OptionTypeDefaultPurpose
itemType"string" | "email""string"With email, an item that is no address shows as a red pill with a message, and blocks the submit.
maxnumberNoneMost items.
suggestionsstring[]NoneOffered as the user types.
placeholderstringNonePlaceholder of the input.

The value is a list of texts. A server error naming offending items ({ message, field, values }) turns those pills red. The invite form's addresses use TagsType({ itemType: "email", max: 50 }).

In tables and read-only forms

The same types read in a table cell, an expanded row or a read-only form: a repeater and a key-value field as a count ("3 rows", "2 entries") in a cell, and as their rows in a read-only form: a table of values, each drawn as a table cell draws it (amounts right-aligned in the form's tabular figures rather than the grid's mono, a select's label, a relation's name, read from its select route for the ids the rows hold alone, ?ids=), text wrapping between words and the table scrolling sideways when its columns cannot fit; in a narrow container (a phone's drawer) a list of more than two fields reads each row as a block of label and value lines instead, so no amount is ever cut. A secret reads masked (••••f3a9), code as its first line, and tags as pills. In a table filter, the new types offer is_empty and is_not_empty, a select keeps its dropdown whatever its display, and a boolean its checked/unchecked select.