Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alineacms/alinea/llms.txt

Use this file to discover all available pages before exploring further.

Scalar fields store a single primitive value — a string, a number, a boolean, or a date. They are the most common fields in any content type and cover the majority of straightforward editorial inputs. All scalar field factories live in the Field namespace exported by alinea.
Importing Field
import {Field} from 'alinea'

Field.text

Field.text renders a single-line or multi-line text input and stores its value as a string. The initial value defaults to an empty string.
Using Field.text
import {Config, Field} from 'alinea'

export const Article = Config.document('Article', {
  fields: {
    title: Field.text('Title', {required: true}),
    subtitle: Field.text('Subtitle', {
      help: 'Displayed below the title',
      width: 0.5
    }),
    notes: Field.text('Internal notes', {
      multiline: true,
      readOnly: false
    }),
    email: Field.text('Contact email', {
      type: 'email',
      placeholder: 'hello@example.com'
    })
  }
})
label
string
required
Human-readable label shown in the dashboard above the input.
multiline
boolean
When true, the input expands to accept line breaks (a <textarea>). Defaults to false.
inline
boolean
Renders a compact, borderless version of the field. Useful inside list rows or object fields.
type
'email' | 'tel' | 'text' | 'url'
Maps to the HTML type attribute of the underlying input element, enabling browser-native validation and keyboard hints on mobile.
placeholder
string
Short hint text displayed inside the input when it is empty.
autoFocus
boolean
Focuses this input automatically when the entry form opens.
iconLeft
ComponentType
A React component rendered as an icon on the left side of the input.
iconRight
ComponentType
A React component rendered as an icon on the right side of the input.
searchable
boolean
When true, the text value of this field is indexed and searchable from the dashboard and query layer.
help
ReactNode
Instructional text rendered below the label. Accepts JSX for rich formatting.
width
number
A fraction of the form width (0–1) that this field should occupy. Use 0.5 to place two fields side by side.
required
boolean
Marks the field as required. Saving the entry fails if the value is empty.
readOnly
boolean
Prevents editing the value in the dashboard.
hidden
boolean
Hides the field from the dashboard UI entirely.
shared
boolean
When using i18n, a shared field stores a single value across all locales instead of one per locale.
initialValue
string
The value used when a new entry is created.
validate
(value: string) => boolean | string | undefined
A synchronous validation function. Return undefined or true to pass, a string error message to fail.

Field.number

Field.number renders a numeric input and stores its value as number | null. A null value means the field has not been filled in.
Using Field.number
import {Config, Field} from 'alinea'

export const Product = Config.document('Product', {
  fields: {
    price: Field.number('Price', {
      minValue: 0,
      help: 'Price in USD cents'
    }),
    quantity: Field.number('Quantity', {
      minValue: 0,
      maxValue: 9999,
      step: 1
    })
  }
})
minValue
number
The minimum permitted value.
maxValue
number
The maximum permitted value.
step
number
The increment between legal values. For example, step: 0.5 allows 0, 0.5, 1, 1.5, and so on.
help
ReactNode
Instructional text below the label.
width
number
Fractional form width (0–1).
inline
boolean
Compact, borderless rendering.
required
boolean
Marks the field as required. Saving the entry fails if the value is empty.
readOnly
boolean
Prevents editing the value in the dashboard.
hidden
boolean
Hides the field from the dashboard UI entirely.
shared
boolean
When using i18n, a shared field stores a single value across all locales instead of one per locale.
initialValue
number | null
The value used when a new entry is created.
validate
(value: number | null) => boolean | string | undefined
A synchronous validation function. Return undefined or true to pass, a string error message to fail.

Field.select

Field.select renders a dropdown and stores one of the predefined option keys as a string. When no initialValue is provided the field value is null until the user makes a selection.
Using Field.select
import {Config, Field} from 'alinea'

export const Post = Config.document('Post', {
  fields: {
    status: Field.select('Status', {
      options: {
        draft: 'Draft',
        review: 'In review',
        published: 'Published'
      },
      initialValue: 'draft',
      width: 0.5
    })
  }
})
The options object maps option keys (stored in the database) to human-readable labels (shown in the dropdown). TypeScript infers a union type from the option keys at the point of definition — for example, 'draft' | 'review' | 'published' above.
options
Record<string, string>
required
An object mapping option keys to display labels.
initialValue
string
The key of the option that is selected when a new entry is created. When set, the return type becomes the union of keys (not nullable).
placeholder
string
Text shown in the dropdown before a value is selected.
help
ReactNode
Instructional text rendered below the label.
inline
boolean
Compact, borderless rendering. Useful inside list rows or object fields.
width
number
Fractional form width (0–1).

Field.check

Field.check renders a checkbox and stores a boolean. The initial value is false.
Using Field.check
import {Config, Field} from 'alinea'

export const Page = Config.document('Page', {
  fields: {
    featured: Field.check('Featured', {
      description: 'Pin this page to the homepage'
    }),
    indexable: Field.check('Allow search indexing', {width: 0.5})
  }
})
description
string
Short text shown next to the checkbox, explaining the toggle.
autoFocus
boolean
Focuses this input automatically when the entry form opens.
width
number
Fractional form width (0–1).
help
ReactNode
Additional instructional text below the label.
inline
boolean
Compact, borderless rendering.

Field.date

Field.date renders a date picker and stores an ISO 8601 date string (e.g. "2024-06-15"). The value is string — no Date object is involved at the data layer, keeping serialisation predictable.
Using Field.date
import {Config, Field} from 'alinea'

export const Event = Config.document('Event', {
  fields: {
    startDate: Field.date('Start date', {required: true}),
    endDate: Field.date('End date', {width: 0.5})
  }
})
required
boolean
Marks the field as required.
autoFocus
boolean
Focuses this input automatically when the entry form opens.
width
number
Fractional form width (0–1).
inline
boolean
Compact, borderless rendering.
help
ReactNode
Instructional text below the label.

Field.time

Field.time renders a time picker and stores the selected time as a string (e.g. "14:30"). It supports optional minValue, maxValue, and step constraints, mirroring the HTML <input type="time"> API.
Using Field.time
import {Config, Field} from 'alinea'

export const Session = Config.document('Session', {
  fields: {
    startTime: Field.time('Start time', {
      minValue: '08:00',
      maxValue: '20:00',
      step: 900  // 15-minute intervals (in seconds)
    }),
    endTime: Field.time('End time', {width: 0.5})
  }
})
minValue
string
The earliest permitted time string (e.g. "09:00").
maxValue
string
The latest permitted time string (e.g. "18:00").
step
number
The step interval in seconds. For example, 900 enforces 15-minute intervals.
autoFocus
boolean
Focuses this input automatically when the entry form opens.
inline
boolean
Compact, borderless rendering.

Field.code

Field.code renders a syntax-highlighted code editor and stores its value as a string. Use the language option to hint the editor which syntax to apply.
Using Field.code
import {Config, Field} from 'alinea'

export const Snippet = Config.document('Code snippet', {
  fields: {
    code: Field.code('Source code', {
      language: 'typescript',
      help: 'Paste your TypeScript snippet here'
    })
  }
})
language
string
A language identifier string (e.g. "typescript", "css", "bash") used for syntax highlighting.
help
ReactNode
Instructional text below the label.
inline
boolean
Compact, borderless rendering.
width
number
Fractional form width (0–1).

Field.json

Field.json renders a JSON editor and stores the raw parsed value. It is generic — Field.json<MyType>(...) — so the TypeScript type of the stored value can be anything JSON-serialisable.
Using Field.json
import {Config, Field} from 'alinea'

interface ThemeConfig {
  primaryColor: string
  spacing: number
}

export const SiteSettings = Config.document('Site settings', {
  fields: {
    theme: Field.json<ThemeConfig>('Theme config', {
      help: 'Raw JSON configuration object'
    })
  }
})
autoFocus
boolean
Focuses this input automatically when the entry form opens.
help
ReactNode
Instructional text below the label.
inline
boolean
Compact, borderless rendering.
width
number
Fractional form width (0–1).

Field.path

Field.path stores a URL path segment string (e.g. "my-post-title"). It can be configured to automatically derive its value from another field via the from option.
The shared option is not supported on path fields — Alinea will throw an error at boot time if you set shared: true on a path field.
Using Field.path
import {Config, Field} from 'alinea'

export const Article = Config.document('Article', {
  fields: {
    title: Field.text('Title'),
    // Automatically slugifies the `title` field
    path: Field.path('URL path', {
      from: 'title'
    }),
    // Lock the path after initial creation
    canonicalPath: Field.path('Canonical path', {
      readOnly: true
    })
  }
})
from
string
The key of another field in the same type. When the referenced field changes, the path is automatically re-derived (slugified) from that value.
readOnly
boolean
Prevents editing the path in the dashboard after it is set.
hidden
boolean
Hides the path field from the dashboard form.
width
number
Fractional form width (0–1).

Build docs developers (and LLMs) love