Skip to main content

SearchBar

Search input component with icon and styling.

Props

PropTypeRequiredDefaultDescription
placeholderstringNo'Search'Placeholder text for input
valuestringNo—Controlled input value
onChange(value: string) => voidNo—Change handler
onClear() => voidNo—Clear button handler
showSubmitbooleanNofalseShow submit (search) button
showShortcutHintbooleanNofalseShow / keyboard hint when empty
inputIdstringNoautoInput element id
inputRefRef<HTMLInputElement>No—Ref to the input element
namestringNo'search'Input name
classNamestringNo—Outer wrapper classes
containerClassNamestringNo—Inner container classes
fieldClassNamestringNo—Field shell classes
inputClassNamestringNo—Input 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