TextArea
文字数制限があるなら description に残り数を出す。送信してから怒られるのは最悪の体験。
デモ
Props
| 名前 | 型 | 説明 |
|---|---|---|
| variant | 'solid' | 'outline' | 'soft' | 'ghost' | 'plain' | |
| size | 'sm' | 'md' | 'lg' | |
| radius | 'none' | 'sm' | 'md' | 'lg' | 'full' | |
| label | ReactNode | |
| placeholder | string | |
| description | ReactNode | |
| errorMessage | ReactNode | |
| name | string | |
| value | string | |
| defaultValue | string | |
| onChange | (value: string) => void | |
| onKeyDown | KeyboardEventHandler<HTMLTextAreaElement> | キー操作。**IME 変換中のキーはここに届かない**(`useImeSafeKeys` を経由する)。 |
| rows | number | |
| maxLength | number | |
| isDisabled | boolean | |
| isReadOnly | boolean | |
| isRequired | boolean | |
| isInvalid | boolean | |
| classNames | ClassNames<typeof textareaSlots> |
Slot
構成部位に data-slot が出力されます。 CSS の上書きやテストはこれを狙ってください。
- root必須
- label
- inputWrapper必須
- textarea必須
- description
- errorMessage
アクセシビリティ
- `label` は必須。`description` と `errorMessage` は `aria-describedby` で関連付く。 改行が入る入力のため Enter では送信しない
- キーボードだけで操作できます。フォーカスリングはコントラスト比 3:1 以上です。
- 本文のコントラスト比は light / dark とも 4.5:1 以上を検査で保証しています。
prefers-reduced-motionが有効なときはアニメーションを行いません。