---
title: Textarea
description: "`Textarea`は、複数行のテキスト入力を取得するために使用されるコンポーネントです。"
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
---
```tsx
```
## 使い方
```tsx
import { Textarea } from "@yamada-ui/react"
```
```tsx
import { Textarea } from "@/components/ui"
```
```tsx
import { Textarea } from "@workspaces/ui"
```
```tsx
```
### バリアントを変更する
```tsx
{(variant) => (
)}
```
### サイズを変更する
```tsx preview
{(size) => (
)}
```
### カラースキームを変更する
```tsx
{(colorScheme) => (
)}
```
### 無効にする
無効にする場合は、`disabled`を`true`に設定します。
```tsx
{(variant) => (
)}
```
### 読み取り専用にする
読み取り専用にする場合は、`readOnly`を`true`に設定します。
```tsx
{(variant) => (
)}
```
### 無効な入力にする
無効な状態にする場合は、`invalid`を`true`に設定します。
```tsx
{(variant) => (
)}
```
### ボーダーの色を変更する
ボーダーの色を変更する場合は、`focusBorderColor`または`errorBorderColor`に値を設定します。
```tsx
```
### プレースホルダーをカスタマイズする
プレースホルダーの色を変更する場合は、propsに`_placeholder`を設定します。
```tsx
```
### リサイズの動作を変更する
リサイズの動作を変更する場合は、`resize`に`"block"`、`"horizontal"`、`"vertical"`、`"none"`のいずれかを設定します。
```tsx
{(resize) => (
)}
```
### 自動リサイズを使用する
自動リサイズを有効にする場合は、`autosize`を`true`に設定します。
```tsx
```
### リサイズを制御する
```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" \| "ActiveBorder" \| "ActiveCaption" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" \| "amber.400" \| "amber.50" \| "amber.500" ...` | The border color when the input is invalid. |
| `focusBorderColor` | - | `"-moz-initial" \| "ActiveBorder" \| "ActiveCaption" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" \| "amber.400" \| "amber.50" \| "amber.500" ...` | 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. |
## アクセシビリティ
現在、v2の移行に伴い、このセクションは更新中です。