Textarea
여러 줄 텍스트 입력 요소예요. 자동 높이 조절, 플로트 라벨, 크기 변형 등 다양한 옵션을 지원해요.
출처: 문서
본문
Textarea는 여러 줄(multi-line) 텍스트 입력 요소예요.
사용법 (Usage)
import { Textarea } from '@primereact/ui/textarea';
<Textarea />
예제 (Examples)
기본 (Basic)
더 긴 자유 형식 텍스트 내용을 입력받기 위한 여러 줄 입력이에요.
자동 크기 조절 (Auto Resize)
autoResize 속성을 설정하면 Textarea가 내용에 맞춰 높이를 자동으로 조절해요.
플로트 라벨 (Float Label)
포커스되면 입력 필드 위에 플로팅 라벨이 나타나요. 자세한 내용은 FloatLabel 문서를 참고하세요.
이프타 라벨 (Ifta Label)
IftaLabel은 필드 안쪽 상단에 정렬된 라벨을 만드는 데 사용해요. 자세한 내용은 IftaLabel 문서를 참고하세요.
크기 (Sizes)
size 속성을 설정하면 기본 크기 외에 small과 large 크기를 사용할 수 있어요.
채우기 (Filled)
variant 속성을 filled로 지정하면 기본 outlined 스타일보다 시각적 강조가 더 강한 모습으로 표시돼요.
유효하지 않음 (Invalid)
invalid prop으로 유효하지 않은 상태를 표시해서 검증 실패를 나타낼 수 있어요. 폼 검증 라이브러리와 통합할 때 유용한 스타일이에요.
비활성 (Disabled)
disabled가 있으면 요소를 수정하거나 포커스할 수 없어요.
관련 자료 (Related)
하위 컴포넌트 (Sub-Components)
Textarea 컴포넌트 문서는 Primitive API에서 확인할 수 있어요.
훅 (Hooks)
useTextarea 훅 문서는 Headless API에서 확인할 수 있어요.
접근성 (Accessibility)
WAI-ARIA 준수 상세와 키보드 지원은 Textarea Primitive에서 확인할 수 있어요.
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-textarea | Class name of the root element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.
| Token | CSS Variable | Description |
|---|---|---|
| textarea.background | --p-textarea-background | Background of root |
| textarea.disabled.background | --p-textarea-disabled-background | Disabled background of root |
| textarea.filled.background | --p-textarea-filled-background | Filled background of root |
| textarea.filled.hover.background | --p-textarea-filled-hover-background | Filled hover background of root |
| textarea.filled.focus.background | --p-textarea-filled-focus-background | Filled focus background of root |
| textarea.border.color | --p-textarea-border-color | Border color of root |
| textarea.hover.border.color | --p-textarea-hover-border-color | Hover border color of root |
| textarea.focus.border.color | --p-textarea-focus-border-color | Focus border color of root |
| textarea.invalid.border.color | --p-textarea-invalid-border-color | Invalid border color of root |
| textarea.color | --p-textarea-color | Color of root |
| textarea.disabled.color | --p-textarea-disabled-color | Disabled color of root |
| textarea.placeholder.color | --p-textarea-placeholder-color | Placeholder color of root |
| textarea.invalid.placeholder.color | --p-textarea-invalid-placeholder-color | Invalid placeholder color of root |
| textarea.shadow | --p-textarea-shadow | Shadow of root |
| textarea.padding.x | --p-textarea-padding-x | Padding x of root |
| textarea.padding.y | --p-textarea-padding-y | Padding y of root |
| textarea.border.radius | --p-textarea-border-radius | Border radius of root |
| textarea.focus.ring.width | --p-textarea-focus-ring-width | Focus ring width of root |
| textarea.focus.ring.style | --p-textarea-focus-ring-style | Focus ring style of root |
| textarea.focus.ring.color | --p-textarea-focus-ring-color | Focus ring color of root |
| textarea.focus.ring.offset | --p-textarea-focus-ring-offset | Focus ring offset of root |
| textarea.focus.ring.shadow | --p-textarea-focus-ring-shadow | Focus ring shadow of root |
| textarea.transition.duration | --p-textarea-transition-duration | Transition duration of root |
| textarea.sm.font.size | --p-textarea-sm-font-size | Sm font size of root |
| textarea.sm.padding.x | --p-textarea-sm-padding-x | Sm padding x of root |
| textarea.sm.padding.y | --p-textarea-sm-padding-y | Sm padding y of root |
| textarea.lg.font.size | --p-textarea-lg-font-size | Lg font size of root |
| textarea.lg.padding.x | --p-textarea-lg-padding-x | Lg padding x of root |
| textarea.lg.padding.y | --p-textarea-lg-padding-y | Lg padding y of root |
| textarea.font.weight | --p-textarea-font-weight | Font weight of root |
| textarea.font.size | --p-textarea-font-size | Font size of root |