Show navigationHide navigation

Text

Multi-line textarea for longer plain text. Use for descriptions, summaries, meta descriptions, and other content that doesn't need formatting.

Usage#

typescript
description: { label: 'Description', format: 'text' },

Options#

OptionTypeDefaultDescription
requiredbooleanfalseMust be non-empty after trimming
rowsnumber4Visible textarea rows in the editor
hintstringHelper text below the field

Example: SEO meta description#

Schema — a page with a meta description for search engines:

typescript
// cms/octocms.config.ts
page: {
  label: 'Page',
  hasMany: true,
  fields: {
    title: { label: 'Title', format: 'string', entryTitle: true, required: true },
    metaDescription: {
      label: 'Meta Description',
      format: 'text',
      rows: 3,
      hint: 'Shown in search engine results. Keep under 160 characters.',
    },
    body: { label: 'Body', format: 'markdown' },
  },
},

Query + render:

tsx
// src/app/[slug]/page.tsx
import { query } from 'cms/__generated__/query';
import type { Metadata } from 'next';

export async function generateMetadata({ params }: { params: { slug: string } }): Promise<Metadata> {
  const page = await query('page').filter({ slug: params.slug }).first();
  return {
    title: page?.fields.title,
    description: page?.fields.metaDescription,
  };
}

Storage#

Plain string in the entry JSON. Values are trimmed on save (leading/trailing whitespace removed).

json
{ "metaDescription": "A lightweight CMS for Next.js developers." }

Query result#

Returned as-is — string.