Skip to main content

SearchBar

Search input component with icon and styling.

Props

PropTypeRequiredDefaultDescription
placeholderstringNo'Search'Placeholder text for input
valuestringNoControlled input value
onChange(value: string) => voidNoChange handler
onClear() => voidNoClear button handler
showSubmitbooleanNofalseShow submit (search) button
showShortcutHintbooleanNofalseShow / keyboard hint when empty
inputIdstringNoautoInput element id
inputRefRef<HTMLInputElement>NoRef to the input element
namestringNo'search'Input name
classNamestringNoOuter wrapper classes
containerClassNamestringNoInner container classes
fieldClassNamestringNoField shell classes
inputClassNamestringNoInput element classes

Usage

import { SearchBar } from '@/components/molecules/SearchBar';

<SearchBar placeholder="Search articles..." showShortcutHint />

Features

  • Compact h-10 pill field aligned with the Ask Dex trigger
  • Search icon on the left
  • Optional / shortcut hint (hidden while the field has a value)
  • Optional clear and submit controls
  • Uses design system colors and typography

Notes

  • Client-side component (uses 'use client')
  • Uses Icons component for search / clear icons
  • Keyboard focus-on-/ is handled by consumers (e.g. HeaderSearch), not by SearchBar itself