Skip to content

Field Types

Each field in a content type has a type that controls how it is edited in the admin panel and how its value is stored.

Supported fields can include a default option. Defaults pre-fill new entries in the admin editor and are also applied when entries are created through the API with that field omitted. Defaults are supported for text, textarea, markdown, number, range, boolean, select, date, datetime, json, and color fields.

Text fields

text

A single-line text input.

OptionDescription
requiredWhether the field must have a value before saving.
defaultInitial value used for new entries when omitted.

textarea

A multi-line plain text area.

Supports default.


markdown

A rich Markdown editor with a live preview pane. The value is stored as a Markdown string.

Supports default.


slug

A URL-safe identifier (lowercase, hyphens). Can optionally be auto-generated from another field.

OptionDescription
sourceThe key of another field to generate the slug from (e.g. "title").

Numeric fields

number

A numeric input. Stores the value as a number.

Supports default.


range

A slider input with configurable min/max/step and display precision.

OptionDescription
minMinimum value (default 0).
maxMaximum value (default 100).
stepStep increment for slider selection (default 1).
defaultInitial slider value for new entries.
display_decimalsOutput precision: 0, 1, 2, 3, or full (default 0).

Boolean

boolean

A toggle (true/false). Stored as a JSON boolean.

Supports default.


Date & time

date

A date picker. Stores an ISO 8601 date string (YYYY-MM-DD).

Supports default.


datetime

A date + time picker. Stores a full ISO 8601 datetime string.

Supports default.


Selection

select

A dropdown with predefined options.

OptionDescription
optionsArray of { value, label } objects or plain strings.
multipleAllow selecting more than one value. Multi-select values are stored as arrays.
defaultInitial option value, or array of option values for multi-select.

Example field definition:

json
{
  "key": "status",
  "type": "select",
  "label": "Status",
  "options": ["draft", "published", "archived"]
}

Media

media

A media picker that selects one or more files from the Media Library.

OptionDescription
multipleAllow selecting more than one file in the admin UI.

Media values are stored as an array of filenames. For single-select media fields, the admin UI limits selection to one item. Public API responses return media fields as arrays of absolute media URLs.


Relational

relation

Links an entry to one or more entries in another (or the same) collection.

OptionDescription
targetThe name of the target content type (e.g. "authors").
multipleAllow selecting multiple related entries.

Stores the id of the referenced entry. Multi-relation fields store an array of ids.


Structured

json

A raw JSON editor. Useful for storing arbitrary structured data. The value is stored as-is in the entry JSON.

Supports default.


Color

color

A color picker. Stores a hex color string such as #ff0000.

Supports default.

CometCMS Documentation