Lynx
Text Field Input
한 줄 텍스트를 입력받고 Field의 레이블·설명·오류 상태와 조합하는 컴포넌트입니다.
사용 가능 버전@seed-design/[email protected], @seed-design/[email protected]
Installation
의존성 설치
아래 코드를 복사 후 붙여넣고 사용하세요
Props
TextField
Prop
Type
children?React.ReactNodelabel?React.ReactNodelabelWeight?"medium" | "bold" | undefinedindicator?React.ReactNodeprefixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefinedprefix?React.ReactNodesuffixIcon?React.ReactElement<LynxIconElementProps, string | React.JSXElementConstructor<any>> | undefinedsuffix?React.ReactNodedescription?React.ReactNodeerrorMessage?React.ReactNodehideCharacterCount?boolean | undefinedmaxGraphemeCount?number | undefinedshowRequiredIndicator?boolean | undefinedfieldRef?React.Ref<NodesRef> | undefinedonValueChange?((values: { value: string; graphemes: string[]; slicedValue: string; slicedGraphemes: string[]; }) => void) | undefinedvalue?string | undefineddefaultValue?string | undefinedrequired?boolean | undefinedname?string | undefinedstyle?CSSProperties | undefinedclassName?string | undefinedTextFieldInput
Prop
Type
placeholder?string | undefinedconfirm-type?"send" | "search" | "go" | "done" | "next" | undefinedmaxlength?number | undefinedreadonly?boolean | undefineddisabled?boolean | undefinedshow-soft-input-on-focus?boolean | undefinedinput-filter?string | undefinedtype?"number" | "text" | "digit" | "password" | "tel" | "email" | undefinedios-auto-correct?boolean | undefinedios-spell-check?boolean | undefinedandroid-fullscreen-mode?boolean | undefinedbindfocus?((e: BaseEvent<"bindfocus", InputFocusEvent>) => void) | undefinedbindblur?((e: BaseEvent<"bindblur", InputBlurEvent>) => void) | undefinedbindconfirm?((e: BaseEvent<"bindconfirm", InputConfirmEvent>) => void) | undefinedbindinput?((e: BaseEvent<"bindinput", InputInputEvent>) => void) | undefinedbindselection?((e: BaseEvent<"bindselection", InputSelectionEvent>) => void) | undefinedid?string | undefinedname?string | undefinedflatten?boolean | undefinedfocusable?boolean | undefinedbindlayoutchange?EventHandler<LayoutChangeDetailEvent<Target>> | undefinedmain-thread:bindlayoutchange?EventHandler<LayoutChangeDetailEvent<Element>> | undefinedstyle?CSSProperties | undefinedclassName?string | undefinedUsage
Snippet의 TextField가 label, description, required indicator와 한 줄 입력 영역을 조합합니다. Lynx에는 HTML label for 연결이 없으므로 native 입력에는 accessibility-label을 함께 지정합니다.
Controlled value
value와 onValueChange를 전달하면 controlled mode로 동작합니다. Lynx native 입력에는 value attribute가 없으므로 컴포넌트가 setValue UI method로 값을 동기화합니다.
Grapheme limit
이모지·조합 문자를 사용자에게 보이는 한 글자로 계산하려면 snippet의 maxGraphemeCount와 onValueChange를 사용합니다.
Keyboard avoidance
KeyboardAvoidingScrollView 안에 배치하면 TextFieldInput이 focus될 때 자동으로 등록되어 키보드에 가려지지 않는 위치로 스크롤됩니다.
Web Version Differences
- 편집 가능한 상태에서는 HTML
<input>대신 Lynx native<input>element를 렌더링합니다. readOnly상태에서는 native focus·selection·잘라내기 메뉴를 제거하기 위해<text>element로 렌더링합니다. 이 상태의 ref는<text>를 가리키며 input 전용 UI method와 이벤트는 사용할 수 없습니다.onChange대신 snippetTextField의onValueChange를 사용합니다. 원문과 grapheme 단위로 자른 값을 함께 제공합니다.- native
bindinput은TextFieldInput에 추가로 전달할 수 있습니다. Field.Label과 입력의 DOM id 연결이 없으므로accessibility-label을 입력에 직접 제공합니다.KeyboardAvoidingScrollView가 키보드 회피를 전담하는 화면에서는 Android host window의 별도 pan/resize를 막기 위해android-set-soft-input-mode="nothing"을 명시할 수 있습니다. 이 값은 host window 전역에 영향을 주므로 컴포넌트가 자동으로 적용하지 않습니다.size="responsive"는 CSS viewport breakpoint가 없는 Lynx에서 지원하지 않습니다.large또는medium을 명시합니다.
Unsupported Lynx Features
- HTML form submit, browser validation,
aria-describedbyid 연결은 지원하지 않습니다.
Last updated on