Schema Types
Text
Multi-line text input for longer content.
The text type renders a multi-line textarea. Use this for content that spans multiple lines like descriptions, bios, or body text.
For single-line text, use string instead.
Definition
import type { TextField } from '@aphexcms/cms-core';{
name: 'bio',
type: 'text',
title: 'Biography'
}Properties
| Property | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Field identifier. |
type | 'text' | Yes | Must be 'text'. |
title | string | Yes | Label shown in the admin UI. Also used as placeholder text. |
description | string | No | Help text shown below the label. |
rows | number | No | Fixed number of rows for the textarea. If omitted, it uses a min height of 100px and grows with content. |
initialValue | string | () => string | Promise<string> | No | Default value. |
validation | (Rule) => Rule | No | Validation rules. |
The type definition also includes maxLength and placeholder properties. These are reserved for future use and are not yet consumed by the component — use validation: (Rule) => Rule.max(n) for length limits.
Examples
Basic textarea
{
name: 'description',
type: 'text',
title: 'Description'
}Fixed height
{
name: 'content',
type: 'text',
title: 'Content',
rows: 10
}With validation
{
name: 'excerpt',
type: 'text',
title: 'Excerpt',
validation: (Rule) => Rule.required().max(280)
}Validation
Available rules: required(), min(length), max(length), length(exact), regex(pattern, name?), custom(fn), error(msg), warning(msg), info(msg)
Edit on GitHub
Last updated on