Skip to content

Forms

Textarea

tsx
"use client";
import { Field, Textarea } from "@cherry-design-system/react";

export function Bio() {
  return (
    <Field label="Bio">
      <Textarea name="bio" />
    </Field>
  );
}

A multi-line text input that grows with its content. Use it for comments, descriptions and messages. Use Input for single-line values.

Examples

Row cap and character count

maxRows stops the growth and scrolls beyond it. showCount shows a count against maxLength when set.

tsx
"use client";
import { Field, Textarea } from "@cherry-design-system/react";

export function ShortBio() {
  return (
    <Field label="Bio" hint="Shown on your public profile.">
      <Textarea maxRows={8} maxLength={160} showCount />
    </Field>
  );
}

Fixed height

Turn off autoResize and set rows for a fixed height.

tsx
"use client";
import { Field, Textarea } from "@cherry-design-system/react";

export function Notes() {
  return (
    <Field label="Notes">
      <Textarea autoResize={false} rows={6} />
    </Field>
  );
}

Translated count

countLabel builds the text screen readers hear for the count.

tsx
"use client";
import { Field, Textarea } from "@cherry-design-system/react";

export function Comentario() {
  return (
    <Field label="Comentario">
      <Textarea
        maxLength={280}
        showCount
        countLabel={(count, max) => `${count} de ${max} caracteres`}
      />
    </Field>
  );
}

Properties

size"sm" | "md" | "lg"

Text size and padding. Defaults to "md".

invalidboolean

Error state; set automatically inside a <Field error>.

autoResizeboolean

Grow with the content (CSS field-sizing, with a JS fallback). Defaults to true.

maxRowsnumber

Cap for auto-resize, in rows; scrolls beyond it.

showCountboolean

Show a character count (against maxLength when set).

countLabel(count: number, max: number | undefined) => string

Accessible text for the count. Defaults to "{count} of {max} characters", or "{count} characters" without maxLength.

wrapperClassNamestring

Class for the outer wrapper (className goes to the <textarea>).

The ref and all native <textarea> attributes go to the <textarea>.

Styling

Root class cherry-textarea with data-size (sm, md, lg) and states data-invalid, data-disabled, data-auto-resize, data-limit, :focus-within. Parts: cherry-textarea__control, cherry-textarea__count.

Reads the same field tokens as Input: --cherry-bg-canvas, --cherry-border-default, --cherry-border-focus, --cherry-ring and --cherry-ring-danger.

Accessibility

Label it like Input, with Field or aria-label. showCount links the counter to the textarea with aria-describedby.