> ## Documentation Index
> Fetch the complete documentation index at: https://docs.frogbot.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Textarea Field

> Store longer plain-text content with a multiline admin input.

The Textarea field stores a string like the [Text field](https://docs.frogbot.ai/fields/text.md), but provides a multiline input suited to longer content.

```ts theme={"theme":"tokyo-night"}
import type { Field } from 'frogbot'

export const Summary: Field = {
  name: 'summary',
  type: 'textarea',
  required: true,
}
```

## Config options

| Option | Type | Default | Description |
| - | - | - | - |
| `name` | `string` | Required | Property name used in stored records and APIs. See [field names](https://docs.frogbot.ai/fields/overview.md#field-names). |
| `type` | `'textarea'` | Required | Selects the Textarea field. |
| `minLength` | `number` | — | Minimum string length, checked by the built-in validator. |
| `maxLength` | `number` | Root `defaultMaxTextLength` (`40000`) | Maximum string length, checked by the built-in validator. |
| `label` | `string \| Record<string, string> \| (({ i18n, t }) => string) \| false` | Generated from `name` | Label shown in the admin panel. Use an object keyed by language code for translations, or `false` to hide the label. |
| `required` | `boolean` | `false` | Rejects an empty value in the default validation. |
| `unique` | `boolean` | `false` | Creates a unique database index for the field path. See [indexes](https://docs.frogbot.ai/database/indexes.md). |
| `index` | `boolean` | `false` | Creates a database index for faster queries. `unique` already creates one. |
| `localized` | `boolean` | `false` | Stores one value per configured locale. Ignored without [localization](https://docs.frogbot.ai/configuration/localization.md) or inside a localized parent. |
| `defaultValue` | `string` or `({ locale, req, user }) => value` | — | Value used when the field has no value. See [default values](https://docs.frogbot.ai/fields/overview.md#default-values). |
| `validate` | `Validate` | Built-in validator | Replaces the built-in validator. See [validation](https://docs.frogbot.ai/fields/overview.md#validation). |
| `hooks` | `{ beforeValidate, beforeChange, afterChange, afterRead, beforeDuplicate }` | — | Arrays of `FieldHook` functions for each phase. See [field hooks](https://docs.frogbot.ai/hooks/fields.md). |
| `access` | `{ create, read, update }` | Allowed | `FieldAccess` functions for each operation. See [field access control](https://docs.frogbot.ai/access-control/fields.md). |
| `hidden` | `boolean` | `false` | Removes the field from API responses and the admin panel while keeping stored data. |
| `saveToJWT` | `boolean \| string` | `false` | In an auth-enabled collection, copies the value into the user's token. A string sets the token key. See [token data](https://docs.frogbot.ai/authentication/token-data.md). |
| `virtual` | `boolean \| string` | `false` | `true` skips database storage; a string reads a value through a relationship path. Virtual fields are read-only in the admin panel unless `admin.readOnly` is `false`. See [virtual fields](https://docs.frogbot.ai/fields/overview.md#virtual-field-configuration). |
| `disableDuplicate` | `boolean` | `false` | Leaves the value out when a document is duplicated, so the copy uses `defaultValue`. |
| `admin` | `object` | — | Admin-panel options. See [Admin options](#admin-options). |
| `custom` | `Record<string, any>` | — | Server-only metadata for your own code and plugins. Use `admin.custom` for data the browser also needs. |
| `jsonSchema` | `Array<({ jsonSchema }) => JSONSchema4>` | — | Functions that modify the JSON Schema used by [type generation](https://docs.frogbot.ai/typescript/generating-types.md). |

## Admin options

Textarea fields support the standard [field admin options](https://docs.frogbot.ai/fields/overview.md#admin-options), plus these options:

| Option | Description |
| - | - |
| **`placeholder`** | Placeholder text shown in the textarea. |
| **`rows`** | Number of visible text rows. Defaults to `2`. |
| **`rtl`** | Set to `true` to force right-to-left text direction. |

## Example

```ts theme={"theme":"tokyo-night"}
import type { CollectionConfig } from 'frogbot'

export const Articles: CollectionConfig = {
  slug: 'articles',
  fields: [
    {
      name: 'metaDescription',
      type: 'textarea',
      required: true,
      admin: {
        placeholder: 'Summarize this article',
        rows: 4,
      },
    },
  ],
}
```

## Custom components

### Field

#### Server component

```tsx theme={"theme":"tokyo-night"}
import { TextareaField } from '@frogbotai/ui/admin'
import type { TextareaFieldServerProps } from 'frogbot'

export const CustomTextareaServer = (props: TextareaFieldServerProps) => (
  <TextareaField
    field={props.clientField}
    path={props.path}
    permissions={props.permissions}
    schemaPath={props.schemaPath}
  />
)
```

#### Client component

```tsx theme={"theme":"tokyo-night"}
'use client'

import { TextareaField } from '@frogbotai/ui/admin'
import type { TextareaFieldClientProps } from 'frogbot'

export const CustomTextareaClient = (props: TextareaFieldClientProps) => <TextareaField {...props} />
```

### Label

#### Server component

```tsx theme={"theme":"tokyo-night"}
import { FieldLabel } from '@frogbotai/ui/admin'
import type { TextareaFieldLabelServerProps } from 'frogbot'

export const CustomTextareaLabelServer = ({ clientField, path }: TextareaFieldLabelServerProps) => (
  <FieldLabel
    label={clientField.label || clientField.name}
    path={path}
    required={clientField.required}
  />
)
```

#### Client component

```tsx theme={"theme":"tokyo-night"}
'use client'

import { FieldLabel } from '@frogbotai/ui/admin'
import type { TextareaFieldLabelClientProps } from 'frogbot'

export const CustomTextareaLabelClient = ({ field, path }: TextareaFieldLabelClientProps) => (
  <FieldLabel label={field.label || field.name} path={path} required={field.required} />
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.