---
title: Textarea
description: "`Textarea` is a component used to obtain multi-line text input."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/textarea/textarea.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/textarea
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-textarea--basic
---
# Textarea
`Textarea` is a component used to obtain multi-line text input.
```tsx
```
## Usage
```tsx
import { Textarea } from "@yamada-ui/react"
```
```tsx
import { Textarea } from "@/components/ui"
```
```tsx
import { Textarea } from "@workspaces/ui"
```
```tsx
```
### Change Variants
```tsx
{(variant) => (
)}
```
### Change Size
```tsx preview
{(size) => (
)}
```
### Change Color Scheme
```tsx
{(colorScheme) => (
)}
```
### Disable
To disable the input, set `disabled` to `true`.
```tsx
{(variant) => (
)}
```
### Read-Only
To read-only, set `readOnly` to `true`.
```tsx
{(variant) => (
)}
```
### Invalid
To set invalid state, set `invalid` to `true`.
```tsx
{(variant) => (
)}
```
### Change Border Color
To change the border color, set a color to `focusBorderColor` or `errorBorderColor`.
```tsx
```
### Customize Placeholder
To change the placeholder color, set `_placeholder` to the props.
```tsx
```
### Change Resize Behavior
To change the resize behavior, set `resize` to one of `"block"`, `"horizontal"`, `"vertical"`, or `"none"`.
```tsx
{(resize) => (
)}
```
### Use Auto-resize
To enable auto-resizing, set `autosize` to `true`.
```tsx
```
### Control Resize
```tsx
const resizeRef = useRef<() => void>(null)
const onResize = () => {
resizeRef.current?.()
}
return (
)
```
## Props
| Prop | Default | Type | Description |
| ------------------ | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"2xl" \| "lg" \| "md" \| "sm" \| "xl" \| "xs"` | The size of the component. |
| `variant` | `"outline"` | `"filled" \| "flushed" \| "outline" \| "plain"` | The variant of the component. |
| `autosize` | - | `boolean` | If `true`, the Textarea height auto-adjusts to text height. |
| `errorBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is invalid. |
| `focusBorderColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The border color when the input is focused. |
| `invalid` | `false` | `boolean` | If `true`, the field will be invalid. |
| `maxRows` | `Infinity` | `number` | Autosize up to maxRows rows. |
| `minRows` | `2` | `number` | Autosize up to minRows rows. |
| `resizeRef` | - | `ForwardedRef<() => void>` | Ref to a resize function. |
## Accessibility
If you are not using `Field.Root`, set `aria-label` or `aria-labelledby` to `Textarea`.
```tsx
```
```tsx
Comments
```
### ARIA Roles and Attributes
| Element | Roles and Attributes | Usage |
| ---------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `textarea.ui-textarea` | `aria-invalid` | Sets to `"true"` if `invalid` is set. |
| | `aria-disabled` | Sets to `"true"` if `disabled` is set. |
| | `aria-describedby` | If `Textarea` is within a `Field.Root` and `Field.Root` has an `errorMessage`, `helperMessage`, or a `Field.ErrorMessage`, `Field.HelperMessage`, sets its `id`. |
| | `aria-readonly` | Sets to `"true"` if `readOnly` is set. |
| | `aria-required` | Sets to `"true"` if `required` is set. |
## Similar Components
- [Editable](https://yamada-ui.com/docs/components/editable.md): `Editable` is a component used to obtain inline editable text input.
- [Input](https://yamada-ui.com/docs/components/input.md): `Input` is a component used to obtain text input from the user.
- [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user.
- [PasswordInput](https://yamada-ui.com/docs/components/password-input.md): `PasswordInput` is a component that allows users to input passwords with a visibility toggle.
- [PinInput](https://yamada-ui.com/docs/components/pin-input.md): `PinInput` is a component used to capture pin codes or OTP (One-Time Password) inputs.
- [FileInput](https://yamada-ui.com/docs/components/file-input.md): `FileInput` is a component used for users to select files.
- [Autocomplete](https://yamada-ui.com/docs/components/autocomplete.md): `Autocomplete` is a component used to display suggestions in response to user text input.
- [Checkbox](https://yamada-ui.com/docs/components/checkbox.md): `Checkbox` is a component used for allowing users to select multiple values from multiple options.
## Uses Components & Hooks
- [Input](https://yamada-ui.com/docs/components/input.md): `Input` is a component used to obtain text input from the user.
- [Field](https://yamada-ui.com/docs/components/field.md): `Field` is a component used to group form elements with label, helper message, error message, etc.