Navigation

SearchBar

Search input with live suggestions, recent searches, and keyboard navigation.

SearchBar

A search bar with live suggestions, recent search history, and keyboard navigation. Supports expandable mode with animated transitions.

Preview

Usage

<CSearchBar
  :suggestions="searchResults"
  @search="handleSearch"
  @update:query="fetchSuggestions"
/>

Expandable (Icon-Only → Full)

<CSearchBar expandable />

With Recent Searches

<CSearchBar :recent-searches="['shoes', 'bags', 'watches']" />

Props

PropTypeDefaultDescription
suggestionsSearchSuggestion[][]Live suggestion results
recentSearchesstring[][]Stored recent queries
placeholderstring'Search products...'Input placeholder
expandablebooleanfalseCollapse to icon on small screens
loadingbooleanfalseShow loading indicator
debouncenumber300Debounce time (ms)
uiPartial<{...}>Per-instance theme overrides

Events

EventPayloadDescription
searchstringUser submitted a search
update:querystringInput value changed (debounced)
selectSearchSuggestionSuggestion selected

Slots

SlotScoped PropsDescription
suggestion{ item }Custom suggestion item rendering
no-results{ query }Custom no-results state
recent{ searches, select }Custom recent searches display