Aphex
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

PropertyTypeRequiredDescription
namestringYesField identifier.
type'text'YesMust be 'text'.
titlestringYesLabel shown in the admin UI. Also used as placeholder text.
descriptionstringNoHelp text shown below the label.
rowsnumberNoFixed number of rows for the textarea. If omitted, it uses a min height of 100px and grows with content.
initialValuestring | () => string | Promise<string>NoDefault value.
validation(Rule) => RuleNoValidation 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