Search Trigger
Navigation · SearchTrigger, CommandPalette
A search field that opens your search instead of taking text: the topStart of the standard top bar, opening a CommandPalette. It looks like SearchField and says it opens a dialog.
shortcut="⌘K"shows the key hint (hidden on touch screens);bindShortcutopens it with ⌘/Ctrl + the hint's last key, except while the reader types in a field.- On phones the top bar shows
topStartCompactinstead: pass anIconButtonthat opens the same search.
tsx
<AppShell navigation="sidebar" topbar
topStart={<SearchTrigger placeholder="Search…" shortcut="⌘K" bindShortcut onClick={() => setOpen(true)} />}
topStartCompact={<IconButton icon="search" label="Search" variant="ghost" onClick={() => setOpen(true)} />}
…
/>
<CommandPalette open={open} onClose={() => setOpen(false)} items={pages} />
Click it or press ⌘K.
Props
SearchTrigger
| Prop | Type | Notes |
|---|---|---|
placeholder? | string | The text in the field (default "Search"). |
label? | string | Accessible name instead of the visible text (keep the visible text in it). |
shortcut? | string | The key hint, e.g. "⌘K" (hidden on touch screens). |
bindShortcut? | boolean | ⌘/Ctrl + the hint's last key opens it too, except while typing in a field. |
onClick? | () => void | Opens your search, e.g. a `CommandPalette`. |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |
CommandPalette
| Prop | Type | Notes |
|---|---|---|
items | PaletteItem[] | Required |
onClose? | () => void | |
placeholder? | string | |
inline? | boolean | |
loading? | boolean | Results are on their way (async search): shows a loading row. |
empty? | ReactNode | Shown when nothing matches (default: "Nothing matches …"). |
onQueryChange? | (query: string) => void | Called with the query as the user types, for searching on a server. |
open? | boolean | Optional: with `open` the component stays mounted while it animates out; without it, render it only while open. |
className? | string | Extra class on the root element. |
style? | CSSProperties | Inline style on the root element. |