# Textarea

Multi-line native text entry aligned with Input styling.

Multi-line native text entry aligned with Input styling.

```tsx
import { Stack, Textarea } from "@zentara-co/zenos-ui";

function TextareaPreviewExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Textarea placeholder="What did you find?" rows={3} />
      <Textarea variant="filled" defaultValue="Shared with the review team." rows={3} />
    </Stack>
  );
}
```

```tsx
import { Textarea } from "@zentara-co/zenos-ui";
```

## Sizes

Textarea sizes set a minimum height while preserving native resize and overflow behavior.

```tsx
import { Stack, Textarea } from "@zentara-co/zenos-ui";

function TextareaSizesExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Textarea size="sm" placeholder="Small" rows={3} />
      <Textarea size="md" placeholder="Medium" rows={3} />
      <Textarea size="lg" placeholder="Large" rows={3} />
    </Stack>
  );
}
```

## Variants

Textarea uses the same surfaces as Input: `default` (standard), `filled` (subtle), and `none` (borderless).

```tsx
import { Stack, Textarea } from "@zentara-co/zenos-ui";

type CatalogVariantProps = { limit?: number };

const limited = <T,>(items: readonly T[], limit?: number) =>
  limit === undefined ? items : items.slice(0, limit);

const formControlSurfaceVariants = ["default", "filled", "none"] as const;

function TextareaVariantsExample({ limit }: CatalogVariantProps = {}) {
  if (limit !== undefined) {
    return (
      <Stack gap="3" className="w-full max-w-sm">
        {limited(formControlSurfaceVariants, limit).map((variant) => (
          <Textarea key={variant} variant={variant} placeholder={variant} rows={3} />
        ))}
      </Stack>
    );
  }

  return (
    <Stack gap="3" className="w-full max-w-sm">
      {formControlSurfaceVariants.map((variant) => (
        <Textarea
          key={variant}
          variant={variant}
          defaultValue={variant === "none" ? undefined : "Value"}
          placeholder="Placeholder"
          rows={3}
        />
      ))}
    </Stack>
  );
}
```

## States

Hover, focus, filled, invalid, and disabled treatments match Input. Invalid matches Input (`none` stays borderless). Set `aria-invalid` directly or compose with `Field.Root invalid`.

```tsx
import { Stack, Textarea } from "@zentara-co/zenos-ui";

function TextareaStatesExample() {
  return (
    <Stack gap="3" className="w-full max-w-sm">
      <Textarea placeholder="Placeholder" rows={3} />
      <Textarea defaultValue="Value" rows={3} />
      <Textarea aria-invalid defaultValue="Value" rows={3} />
      <Textarea disabled placeholder="Placeholder" rows={3} />
    </Stack>
  );
}
```

## With Field

```tsx
import { Field, Textarea } from "@zentara-co/zenos-ui";

<Field.Root>
  <Field.Label>Investigation notes</Field.Label>
  <Field.Control render={<Textarea rows={5} />} />
</Field.Root>;
```

Textarea follows the shared size, variant, invalid, disabled, required, ref, and native-prop contracts. Use `rows` or application layout for initial height; content remains scrollable.

## Variants

default, filled, none

## Sizes

sm, md, lg

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| variant | default \| filled \| none | default | Surface treatment (`default` = standard, `filled` = subtle, `none` = borderless). |
| size | sm \| md \| lg | md | Minimum control height. |
| aria-invalid | boolean \| grammar \| spelling | — | Native invalid semantics and styling. |
| native props | React.TextareaHTMLAttributes<HTMLTextAreaElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Textarea preserves native keyboard, selection, resize, and form behavior. Give it a visible label and use `Field.Description` for guidance. Error text should explain how to correct the value rather than restating that it is invalid.

Source: https://zenos-ui.pages.dev/components/textarea/