AI search bar
A search field that also answers. Typing lists matching pages with an “Ask AI” row first; choosing it writes a short answer above the results that names the pages it came from. One combobox: arrows move, Enter opens, Escape clears, and “/” focuses the field from anywhere.
Try “can I get a refund if I cancel”, or press / to focus.
When to use
- Help centres, docs and internal wikis where people search with a question rather than a keyword.
- App-wide search in a SaaS product whose records can answer questions.
When not to use
- Command menus that run actions; use the command palette.
- A full conversation; use the AI side panel or a chat screen.
Installation
pnpm dlx shadcn@latest add @caliper/ai-search-bar
Adds its 5 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
AiSearchBar
7 props
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, alert, listbox, status and option semantics, with aria-hidden, aria-label, aria-expanded, aria-controls, aria-autocomplete and aria-activedescendant kept in step with state. Changes that matter are announced through a live region.
Notes for AI
Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.
/docs/components/ai-search-bar.mdThe index of every part is at /llms.txt.