Show navigationHide navigation
Fields Overview
Fields define the shape of each content entry. They are declared per collection in cms/octocms.config.ts:
typescriptcollections: { post: { label: 'Post', hasMany: true, fields: { title: { label: 'Title', format: 'string', entryTitle: true, required: true }, body: { label: 'Body', format: 'markdown' }, category: { label: 'Category', format: 'select', options: [...] }, }, }, }
Available field types#
| Format | Description | Page |
|---|---|---|
| string | Single-line text input | Tags, names, titles |
| text | Multi-line textarea | Descriptions, summaries |
| markdown | Rich markdown editor | Blog posts, documentation |
| richtext | WYSIWYG editor with embeds | Landing pages, newsletters |
| boolean | Yes / No toggle | Featured flags, toggles |
| select | Dropdown or checkbox list | Categories, statuses |
| number | Numeric input | Prices, sort order |
| datetime | Date or date-time picker | Publish dates, event times |
| image | Media library picker + upload | Cover photos, avatars |
| slug | URL-safe identifier | Page URLs, permalinks |
| url | URL input with validation | External links, social profiles |
| color | Color picker with hex output | Brand colors, category badges |
| json | Raw JSON editor | Structured metadata, configs |
| reference | Links to other entries | Post → author, page → posts |
| conditional | Content variants with branch selection | A/B tests, feature flags |
Common options#
Every field supports these options:
| Option | Type | Description |
|---|---|---|
label | string | Display name in the editor (required) |
format | string | Field type (required) |
required | boolean | Prevent saving when empty. Default: false |
hint | string | Helper text shown below the field in the editor |
entryTitle | boolean | Use this field as the entry title in the sidebar. One field per collection. |
searchable | boolean | Include in full-text search index. Default: true for text-like fields |
Validation#
Validation runs twice: in the editor before save (immediate feedback) and server-side in saveFile (cannot be bypassed).
When validation fails:
- Error messages appear under the affected fields
- Fields show an error state (red border)
- The Save button stays disabled until all errors are resolved
Each field type has its own validation rules — see the individual field pages for details.
Entry title#
Mark one field per collection with entryTitle: true. This field is used as the display name in the sidebar list and reference selectors:
typescriptfields: { name: { label: 'Name', format: 'string', entryTitle: true }, }
If no field is marked, the entry ID is used as the title.