Skip to content

SearchBar

A themed search input with a leading magnifier icon and an inline × clear button that appears when the field has content. The container uses Surface so it picks up the glass effect on Quartz automatically.

When to use: Any search or filter input at the top of a list or content section.

When not to use: General form fields — use FormField. Tag entry — use TagInput.

import { SearchBar } from '@/components';
const [query, setQuery] = useState('');
<SearchBar
value={query}
onChangeText={setQuery}
onClear={() => setQuery('')}
placeholder="Search components…"
/>
PropTypeDefaultDescription
valuestringControlled value (required)
onChangeText(text: string) => voidChange handler (required)
onClear() => voidCalled when × is tapped (required)
placeholderstring'Search…'Placeholder text
testIDstringFor testing
const [query, setQuery] = useState('');
const results = items.filter(item =>
item.title.toLowerCase().includes(query.toLowerCase())
);
<SearchBar
value={query}
onChangeText={setQuery}
onClear={() => setQuery('')}
placeholder="Search invoices…"
/>
<ListSection
title={`${results.length} results`}
items={results.map(r => ({
label: r.title,
description: r.date,
rightElement: 'chevron',
onPress: () => open(r.id),
}))}
/>
  • ListSection — pairs naturally with SearchBar for filtered content
  • Input — bare input atom