2023-10-30 22:49:27 +02:00
|
|
|
---
|
|
|
|
|
gitea: none
|
|
|
|
|
include_toc: true
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Fields
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Fields define the columns of a schema. Each field has a `ui` type that controls both storage and the admin UI component rendered.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
## Common Optional Properties
|
|
|
|
|
|
|
|
|
|
Most fields share these optional properties:
|
|
|
|
|
|
|
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `required` | Whether the field must have a value to save as `published` |
|
|
|
|
|
| `nullable` | Allow saving as `null` |
|
|
|
|
|
| `help` | Help text shown below the input |
|
|
|
|
|
| `default` | Default value when creating a new record |
|
|
|
|
|
| `readonly` | Prevent editing from the UI |
|
|
|
|
|
| `group` | Tab group this field belongs to |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Field Types
|
2023-10-30 22:49:27 +02:00
|
|
|
|
|
|
|
|
### text
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
One-line text input.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `min` | Minimum character count |
|
|
|
|
|
| `max` | Maximum character count |
|
|
|
|
|
| `selectOptions` | Array of options. Strings or `[{value, label}]` objects |
|
|
|
|
|
| `optionsFrom` | Schema name to load options from |
|
|
|
|
|
| `optionsField` | Field from `optionsFrom` to use as the value |
|
|
|
|
|
| `optionsSuggest` | Allow typing new values not in the options list |
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-30 22:49:27 +02:00
|
|
|
|
|
|
|
|
### textarea
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Multi-line text input.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `min` | Minimum character count |
|
|
|
|
|
| `max` | Maximum character count |
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-30 22:49:27 +02:00
|
|
|
|
|
|
|
|
### slug
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Slug input. Auto-generates from a source field if left empty.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`, `source`
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `source` | Field name to generate the slug from |
|
|
|
|
|
| `min` | Minimum character count |
|
|
|
|
|
| `max` | Maximum character count |
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-30 22:49:27 +02:00
|
|
|
|
|
|
|
|
### rich
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
WYSIWYG rich text editor.
|
|
|
|
|
|
|
|
|
|
**Required:** `name`, `label`
|
|
|
|
|
|
|
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `min` | Minimum character count |
|
|
|
|
|
| `max` | Maximum character count |
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### markdown
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Markdown editor.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
|
|
|
|
|
|
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `min` | Minimum character count |
|
|
|
|
|
| `max` | Maximum character count |
|
|
|
|
|
|
|
|
|
|
---
|
2023-10-30 22:49:27 +02:00
|
|
|
|
|
|
|
|
### number
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Numeric input.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `decimals` | Number of decimal places. Default: `0` |
|
|
|
|
|
| `min` | Minimum value |
|
|
|
|
|
| `max` | Maximum value |
|
|
|
|
|
| `optionsFrom` | Schema name to load options from |
|
|
|
|
|
| `optionsField` | Field from `optionsFrom` to use as the value |
|
|
|
|
|
| `optionsSuggest` | Allow typing new values not in the options list |
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-30 22:49:27 +02:00
|
|
|
|
|
|
|
|
### checkbox
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Boolean true/false toggle.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
|
|
|
|
### color
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Color picker.
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `selectOptions` | Restrict to a predefined palette |
|
|
|
|
|
| `optionsFrom` | Schema name to load options from |
|
|
|
|
|
| `optionsField` | Field from `optionsFrom` to use as the value |
|
|
|
|
|
| `optionsSuggest` | Allow typing new values not in the options list |
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
|
|
|
|
### date
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Date selector. Stores as a date string.
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `min` | Minimum date |
|
|
|
|
|
| `max` | Maximum date |
|
|
|
|
|
| `selectOptions` | Predefined date options |
|
|
|
|
|
| `optionsFrom` | Schema name to load options from |
|
|
|
|
|
| `optionsField` | Field from `optionsFrom` to use as the value |
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
|
|
|
|
### datetime
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Date and time selector. Stores as an ISO 8601 string.
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `min` | Minimum datetime |
|
|
|
|
|
| `max` | Maximum datetime |
|
|
|
|
|
| `selectOptions` | Predefined datetime options |
|
|
|
|
|
| `optionsFrom` | Schema name to load options from |
|
|
|
|
|
| `optionsField` | Field from `optionsFrom` to use as the value |
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
|
|
|
|
### json
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Raw JSON data field.
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
|
|
|
|
### file
|
|
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Upload or select files from a files schema.
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`, `collections`
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `collections` | Array of file schema names to choose from |
|
|
|
|
|
| `mime` | Allowed MIME types e.g. `["image/*"]` |
|
|
|
|
|
| `min` | Minimum number of files |
|
|
|
|
|
| `max` | Maximum number of files |
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
|
|
|
|
### reference
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
Reference records from another collection.
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
**Required:** `name`, `label`, `collections`
|
2023-10-30 22:49:27 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
| Property | Description |
|
|
|
|
|
|---|---|
|
|
|
|
|
| `collections` | Array of collection schema names to reference |
|
|
|
|
|
| `min` | Minimum number of references |
|
|
|
|
|
| `max` | Maximum number of references |
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
---
|
2023-10-31 01:48:29 +02:00
|
|
|
|
2026-04-20 21:13:31 +03:00
|
|
|
## Example Field
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"ui": "text",
|
|
|
|
|
"name": "title",
|
|
|
|
|
"label": "Title",
|
|
|
|
|
"required": true,
|
|
|
|
|
"min": 3,
|
|
|
|
|
"max": 200,
|
|
|
|
|
"help": "The main title of the post"
|
|
|
|
|
}
|
|
|
|
|
```
|