> For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/llms-full.txt.

# Textarea

Data Entry`@rockshin/tao-ui`

[Examples](#examples)[API](#api)

Multi-line text input with optional auto sizing.

## When to use

Use Textarea for longer freeform content such as descriptions, notes, and comments.

**Recommended**

- Set rows or autoSize based on expected content length.
- Use maxLength when limits are strict.

**Avoid**

- Do not use the component outside its intended interaction model.

## Examples


### Basic usage
```tsx preview
import { Stack, Textarea } from '@rockshin/tao-ui';

function TextareaExample() {
  return (
    <Stack gap="md" style={{ maxWidth: 420 }}>
      <Textarea placeholder="Write a description" />
      <Textarea
        defaultValue="Autosize grows with its content."
        autoSize={{ minRows: 2, maxRows: 5 }}
      />
      <Textarea value="Invalid content" error readOnly />
    </Stack>
  );
}

export default TextareaExample;
```

### Variants
```tsx preview
import { Stack, Textarea } from '@rockshin/tao-ui';

function TextareaVariants() {
  return (
    <Stack gap="md" style={{ maxWidth: 420 }}>
      <Textarea variant="outlined" placeholder="Outlined" />
      <Textarea variant="filled" placeholder="Filled" />
      <Textarea variant="borderless" placeholder="Borderless" />
    </Stack>
  );
}

export default TextareaVariants;
```

### Sizes and autosize
```tsx preview
import { Stack, Textarea } from '@rockshin/tao-ui';

function TextareaSizes() {
  return (
    <Stack gap="md" style={{ maxWidth: 420 }}>
      <Textarea size="small" placeholder="Small" />
      <Textarea
        size="medium"
        autoSize={{ minRows: 2, maxRows: 5 }}
        defaultValue="Autosize grows with content."
      />
      <Textarea size="large" placeholder="Large" />
    </Stack>
  );
}

export default TextareaSizes;
```

### Controlled text and character count
Native maxLength limits input; controlled state displays the character count.
```tsx preview
import { useState } from 'react';
import { Textarea, Stack } from '@rockshin/tao-ui';
export default function Example() {
  const [text, setText] = useState('');
  return (
    <Stack direction="vertical">
      <Textarea
        aria-label="Description"
        value={text}
        maxLength={120}
        onChange={(e) => setText(e.target.value)}
      />
      <output>{text.length} / 120</output>
    </Stack>
  );
}
```

### Bounded automatic height
Enter multiple lines to grow between minRows and maxRows.
```tsx preview
import { Textarea } from '@rockshin/tao-ui';
export default function Example() {
  return (
    <Textarea
      aria-label="Notes"
      autoSize={{ minRows: 2, maxRows: 6 }}
      placeholder="Enter multiple lines…"
    />
  );
}
```

### Read-only, disabled, and error
Distinguish readable content, unavailable input, and an error requiring correction.
```tsx preview
import { Textarea, Stack } from '@rockshin/tao-ui';
export default function Example() {
  return (
    <Stack direction="vertical">
      <Textarea
        aria-label="Read-only notes"
        readOnly
        value="This record is locked."
      />
      <Textarea
        aria-label="Disabled notes"
        disabled
        defaultValue="Unavailable"
      />
      <Textarea
        aria-label="Invalid notes"
        status="error"
        defaultValue="A reason is required."
      />
    </Stack>
  );
}
```

### Submit and reset
Read content by name and use reset to restore the default value.
```tsx preview
import { useState } from 'react';
import { Textarea, Button, Stack } from '@rockshin/tao-ui';
export default function Example() {
  const [saved, setSaved] = useState('');
  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        setSaved(String(new FormData(e.currentTarget).get('notes')));
      }}
      onReset={() => setSaved('')}
    >
      <Stack direction="vertical">
        <Textarea
          name="notes"
          aria-label="Review notes"
          defaultValue="Ready for review"
        />
        <Stack>
          <Button type="submit">Save notes</Button>
          <Button type="reset">Reset</Button>
        </Stack>
        <output aria-live="polite">{saved}</output>
      </Stack>
    </form>
  );
}
```

### Semantic styling
Style the textarea semantic part while retaining component states and focus behavior.
```tsx preview
import { Textarea } from '@rockshin/tao-ui';
export default function Example() {
  return (
    <Textarea
      aria-label="Code notes"
      autoSize
      styles={{ textarea: { fontFamily: 'monospace', lineHeight: 1.8 } }}
      defaultValue="const ready = true;"
    />
  );
}
```

## Clear and count

`Textarea` and `Input.TextArea` are the same component, supporting `allowClear`, `onClear`, `showCount`, `count`, `onPressEnter`, and `variant="underlined"`. [See the Input family examples and API](https://rickyshin93.github.io/tao-ui/components/input.md).

## API


### [#](#textarea)Textarea



| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| autoSize | Auto-grow height to fit content. `true` grows freely; pass min/max rows to clamp. | `boolean | AutoSizeOptions | undefined` | `-` |

