# Textarea

Capture multi-line text input from users. Ideal for comments, descriptions, and feedback.

```tsx
import { Textarea } from '@fluxui-dev/react';

<Textarea />
```

## With placeholder

Display a hint inside the textarea to guide users on what to enter.

```tsx
<Textarea
    label="Order notes"
    placeholder="No lettuce, tomato, or onion..."
/>
```

## Fixed row height

Customize the height of the textarea by passing a `rows` prop.

```tsx
<Textarea rows={2} label="Note" />
```

## Auto-sizing textarea

Using CSS's new `field-sizing` property, the textarea will automatically adjust its height to fit the content by passing in the `rows="auto"` prop.

```tsx
<Textarea rows="auto" />
```

## Configure resize

If you want to restrict the user from resizing the textarea, you can use the `resize="none"` prop.

```tsx
<Textarea resize="vertical" />
<Textarea resize="none" />
<Textarea resize="horizontal" />
<Textarea resize="both" />
```

## Reference

### Textarea

**Prop:**

- `placeholder` - Placeholder text displayed when the textarea is empty.
- `label` - Label text displayed above the textarea. When provided, wraps the textarea in a `Field` component with an adjacent `Field.Label` component. See the [field component](https://fluxui.dev/react/components/field).
- `description` - Help text displayed above the textarea. When provided alongside `label`, appears between the label and textarea within the `Field` wrapper. See the [field component](https://fluxui.dev/react/components/field).
- `descriptionTrailing` - The description provided will be displayed below the textarea instead of above it.
- `badge` - Badge text displayed at the end of the `Field.Label` component when the `label` prop is provided.
- `error` - Error message displayed below the textarea that marks it invalid, defaulting to the validation error for its `name`.
- `value` - Controlled value of the textarea, paired with `onValueChange`.
- `defaultValue` - Initial value of the textarea when uncontrolled.
- `onValueChange` - Callback fired with the new string value when the value changes, while `onChange` remains available for the raw event.
- `rows` - Number of visible text lines. Use `"auto"` for automatic height adjustment. Default: `4`.
- `resize` - Control how the textarea can be resized. Options: `vertical` (default), `horizontal`, `both`, `none`.
- `disabled` - Prevents user interaction with the textarea.
- `invalid` - If `true`, applies error styling to the textarea.
- `className` - CSS classes applied directly to the textarea element rather than the wrapping field, even when `label` is set.

**Attribute:**

- `data-flux-textarea` - Applied to the textarea element for styling and identification.
