프리뷰 또는 이전 버전의 문서를 보고 있습니다.seed-design.io 방문
우리는 왜 디자인 엔지니어를 찾게 됐을까
Skip to Content
Lynx

Search Bar

화면 상단에서 검색어를 입력하는 App Bar입니다. Search Input을 Back·닫기 버튼과 함께 배치합니다.

Engine ≥ 3.6<input>
사용 가능 버전@seed-design/[email protected], @seed-design/[email protected]
Lynx 예제를 불러오는 중입니다.

Search Bar는 App Bar 안에 Search Input snippet을 배치한 컴포넌트입니다. 검색 입력은 AppBarSlot에 두어 좌우 버튼 사이를 채웁니다.

Installation

npx @seed-design/cli@latest add ui:search-bar

CLI로 설치하면 Search Bar가 사용하는 ui:app-bar와 ui:search-input도 함께 설치됩니다.

Usage

import { SearchBar } from "@/components/ui/search-bar";
<SearchBar
  value={value}
  onValueChange={setValue}
  onSubmit={handleSubmit}
  placeholder="검색어를 입력해주세요"
  onClose={handleClose}
/>

Props

Prop

Type

placeholder?string | undefined
accessibility-label?string | undefined

The accessible name of the input.

Default

"검색"

clearButtonLabel?string | undefined

The accessible name of the clear button.

Default

"지우기"

inputProps?SearchInputInputProps | undefined

Props for the input element, e.g. maxlength.

onBack?(() => void) | undefined

Shows the back button and is called when it is tapped. Lynx has no navigation stack, so the screen decides what going back means.

onClose() => void

Called when the close button is tapped.

closeLabel?ReactNode

Default

"닫기"

appBarProps?Omit<AppBarProps, "children"> | undefined

Props for the App Bar, such as theme.

value?string | undefined
defaultValue?string | undefined

Default

""

onValueChange?((value: string) => void) | undefined

native 입력으로 값이 바뀌면 호출됩니다. 현재 값과 같으면 호출하지 않습니다. controlled에서는 부모가 다른 값으로 바꿔 commit하면 native 입력도 그 값으로 되돌립니다.

name?string | undefined

입력 파트의 native name으로 전달됩니다.

onSubmit?((value: string) => void) | undefined

키보드의 검색(확인) 키를 누르면 현재 값과 함께 호출된다.

blurOnSubmit?boolean | undefined

제출한 뒤 입력의 focus를 해제해 키보드를 내린다.

Default

true

onBack, onClose, closeLabel, appBarProps를 제외한 prop은 Search Input snippet으로 전달됩니다.

Examples

Back Button

onBack을 넘기면 Back 버튼을 표시하고, 버튼을 탭하면 onBack을 호출합니다. 검색 플로우에서 이전 화면으로 돌아가는 동작을 제공할 때만 사용하세요.

닫기 버튼은 항상 표시되며, onClose로 동작을 지정합니다. 레이블은 closeLabel로 바꿀 수 있습니다.

Keyboard

키보드의 검색 키를 누르면 onSubmit이 호출되고 입력의 focus가 해제되어 키보드가 내려갑니다. 콘텐츠를 누르거나 스크롤할 때 키보드를 내리는 동작은 화면에서 처리합니다. 위 예제는 콘텐츠를 탭하면 입력의 blur UI method를 호출합니다.

이 예제는 네이티브 키보드 동작을 사용합니다. QR 코드 패널에서 Lynx Explorer로 실행한 뒤 입력 영역을 탭해 확인해 주세요.

웹 버전과의 차이

  • React의 Search Bar는 Stackflow AppScreen의 App Bar를 쓰고 showBackButton으로 pop()을 호출하는 Back 버튼을 표시합니다. Lynx에는 내비게이션 스택이 없으므로 onBack으로 Back 버튼의 표시와 동작을 함께 정합니다.
  • App Bar의 theme 등은 appBarProps로 전달합니다.

Last updated on 2026. 12. 3.