텍스트 입력 필드

텍스트 입력 필드는 사용자가 키보드로 글자, 숫자, 기호 등이 조합된 한 줄의 짧은 텍스트를 입력하는 경우에 사용하는 요소이다.

사용 지침

이름·아이디·검색어 같은 짧은 입력에 사용하고, 라벨·플레이스홀더·오류 메시지·아이콘을 일관된 위치에 배치해 폼 흐름을 예측 가능하게 만듭니다.

예제

기본

도움말

examples/text-input/TextInputDefault.tsx
import { TextInput } from "@/components/ui/text-input"
import { FieldHint } from "@/components/ui/field-message"

크기

도움말

도움말

도움말

examples/text-input/TextInputSizes.tsx
import { TextInput } from "@/components/ui/text-input"
import { FieldHint } from "@/components/ui/field-message"

상태

도움말

성공 메시지
정보 메시지

도움말

도움말

examples/text-input/TextInputStates.tsx
import { TextInput } from "@/components/ui/text-input"

export default function TextInputStates() {

비밀번호 토글 포함

examples/text-input/TextInputWithPasswordToggle.tsx
import { TextInput } from "@/components/ui/text-input"

export default function TextInputWithPasswordToggle() {

지우기 버튼 포함

examples/text-input/TextInputWithClearButton.tsx
import { TextInput } from "@/components/ui/text-input"

export default function TextInputWithClearButton() {

다중 버튼 포함

examples/text-input/TextInputWithMultipleButtons.tsx
import { TextInput } from "@/components/ui/text-input"

export default function TextInputWithMultipleButtons() {

제어 상태

현재 값: 제어된 입력

examples/text-input/TextInputControlled.tsx
"use client"

import * as React from "react"

비제어 상태

비제어 상태로 동작합니다

examples/text-input/TextInputUncontrolled.tsx
import { TextInput } from "@/components/ui/text-input"
import { FieldHint } from "@/components/ui/field-message"

라벨 없음

레이블 없이도 사용할 수 있습니다

examples/text-input/TextInputWithoutLabel.tsx
import { TextInput } from "@/components/ui/text-input"
import { FieldHint } from "@/components/ui/field-message"

힌트 없음

examples/text-input/TextInputWithoutHint.tsx
import { TextInput } from "@/components/ui/text-input"

export default function TextInputWithoutHint() {

속성

이름타입기본값설명
aria-labelstringDefines a string value that labels the current element. @see aria-labelledby.
classNamestring
clearLabelstring내용 삭제내용 삭제 버튼의 접근성 라벨.
defaultValuestring
disabledboolean
errorReactNode
hintReactNode
idstring
informationReactNode
labelstring
onChange((value: string) => void)
onClickMouseEventHandler<HTMLInputElement>
showClearButtonbooleanfalse
showPasswordTogglebooleanfalse
sizeenumlarge
styleCSSProperties
successReactNode
tabIndexnumber
typeHTMLInputTypeAttribute
valuestring