@atlaskit/textarea
텍스트 영역(Textarea)은 더 긴 텍스트 콘텐츠를 위한 여러 줄 텍스트 입력 컨트롤이에요.
출처: 문서
본문
Textarea 컴포넌트
텍스트 영역은 더 긴 텍스트 콘텐츠를 위한 여러 줄 텍스트 입력 컨트롤이에요.
- Keywords: textarea, input, form, text, multiline, field
- Categories: forms-and-input
- Status: general-availability
예시
import Textarea from '@atlaskit/textarea/text-area';
const Examples = (): React.JSX.Element => (
<>
<Textarea placeholder="Enter your text..." />
<Textarea placeholder="Required field" isRequired resize="auto" name="comments" />
</>
);
export default Examples;
Props
| Prop | Type | Description |
|---|---|---|
appearance |
"none" | "subtle" | "standard" |
Controls the appearance of the field |
defaultValue |
string |
The default value of the text area |
isCompact |
boolean |
Sets whether the field should expand to fill available horizontal space |
isDisabled |
boolean |
Sets the field as uneditable, with a changed hover state, and prevents it from showing in the focus order |
isInvalid |
boolean |
Sets styling to indicate that the input is invalid |
isMonospaced |
boolean |
Sets the content text value to monospace |
isReadOnly |
boolean |
If true, prevents the value of the input from being edited |
isRequired |
boolean |
Sets whether the field is required for form that the field is part of |
maxHeight |
string |
The maximum height of the text area |
minimumRows |
number |
The minimum number of rows of text to display |
name |
string |
Name of the input form control |
onBlur |
(event: FocusEvent<HTMLTextAreaElement, Element>) => void |
Handler to be called when the input is blurred |
onChange |
(event: ChangeEvent<HTMLTextAreaElement>) => void |
Handler to be called when the input changes |
onFocus |
(event: FocusEvent<HTMLTextAreaElement, Element>) => void |
Handler to be called when the input is focused |
placeholder |
string |
The placeholder text within the text area |
resize |
"auto" | "none" | "horizontal" | "vertical" | "smart" |
Enables resizing of the text area |
spellCheck |
boolean |
Enables native spell check on the textarea element |
theme |
any |
The theme function TextArea consumes to derive theming constants for use in styling its components |
value |
string |
The value of the text area |
사용 지침
- 폼에서 장문의 여러 줄 텍스트에 사용해요.
- 높이를 확장할 수 있고, 라벨과 선택적 도움말 텍스트가 있어요.
- 중요한 정보에 placeholder를 사용하지 마요—라벨이나 도움말 텍스트를 사용해요.
- 짧고 한 줄짜리 입력에는 TextField를 사용해요.
콘텐츠 지침
- 라벨을 명사 문자열로 작성해요 (예: "Modal title + Description"이 아니라 "Description").
- 명확히 하기 위해 도움말 텍스트를 사용하고, placeholder에 중요한 정보를 넣지 마요.
- 적절한 오류 메시지를 제공해요.
- 콘텐츠 길이와 형식을 고려해요.
접근성 지침
- 라벨이 textarea와 연결되도록 보장해요.
- 중요한 정보에 placeholder를 사용하지 마요—라벨이나 도움말을 사용해요 (검색 예외는 아이콘 + 접근 가능한 라벨이 있는 경우만).
- 모든 textarea에 명확한 라벨을 제공해요.
- 키보드 탐색을 지원해요.
- 필수 필드를 명확히 표시해요.
- 적절한 오류 상태와 메시지를 사용해요.