Expanding search
A search that expands from an icon into a results list.
Press / to search projects and documents.
When to use
- Headers where space is limited.
- Searching a known list of items with groups.
When not to use
- Complex queries; use a full search page.
Installation
terminal
pnpm dlx shadcn@latest add @caliper/expanding-search
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
API reference
ExpandingSearch
8 props
PropTypeDefault
label *string—
items *readonly ExpandingSearchItem[]—
onSelect((item: ExpandingSearchItem) => void)—
placeholderstring"Search"
emptyLabelstring"No matches."
classNamestring—
shortcutstring—
surface"separate" | "connected""separate"
Keyboard
- ↓
- Moves to the next item or value.
- ↑
- Moves to the previous item or value.
- Enter
- Activates the focused control.
- Escape
- Closes or cancels, then returns focus to where it came from.
Accessibility
It exposes combobox, listbox, group and option semantics, with aria-label, aria-expanded, aria-controls, aria-keyshortcuts, aria-hidden and aria-autocomplete kept in step with state.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/expanding-search.mdThe index of every part is at /llms.txt.