AI search barPro
One search card for an app or docs: grouped results as you type, an Ask AI row first; Tab streams a short answer whose numbered citations light their result below.
oxyn add ai-search-barThe preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- Search over docs, customers and issues where a short synthesized answer is often better than ten links, but the links must stay one step away.
When not to use
- A ⌘K palette with an AI mode: use AI command instead.
- A search input whose clear button scales in inside a reserved slot so the width never shifts: use Search field instead.
- Cited sources under an answer: use Source cards instead.
Installation
AI search bar is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add ai-search-barUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Answer
Answer with citation badges.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Results
Results with the Ask AI row.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Empty
Recent searches and suggested questions.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
AiSearchBar
| Prop | Type | Default | Description |
|---|---|---|---|
resultsrequired | Vec<Command> | — | Results (group = section). |
recent | Vec<String> | Default::default() | Recent searches. |
suggestions | Vec<String> | Default::default() | Suggested questions. |
model | String | "Claude Sonnet" | Model name. |
placeholder | String | "Search docs, customers and issues" | Placeholder. |
query | String | Default::default() | Initial query. |
autoplay | bool | Default::default() | Answer on mount for the initial query (demo). |
answerrequired | ScriptedAnswer | — | The answer (citations map to result ids through its sources). |
height | f32 | 320.0 | Body height px. |
width | f32 | 600.0 | Width px. |
nowrequired | ClockMs | — | Clock. |
on_select | EventHandler<String> | — | A result opened. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| ↑or↓ | Move (wraps) |
| Enter | Open, fill a recent search or ask |
| Tab | Ask AI about the query |
| Esc | Close the answer, then clear |
Accessibility
- Combobox with grouped options; each result's citation badge is labelled "Cited as n".
- Hovering or focusing a citation lights its result.
From the spec
The field is a combobox; results are options in labelled groups; the answer region is busy while streaming; citations and badges are labelled.
Motion & interaction
The card keeps its size; the answer slides in above the results. Hovering or focusing a citation lights the result it points to.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Answer in | 200 ms | ease.out | instant |
| Stream | ~45 chars / s | linear | full text |
| Citation light | 160 ms | linear | same |
Responsive behaviour
- 100 % wide up to its width; the body has a fixed height.
Edge cases (spec)
Queries with no results still offer Ask AI. Recent searches de-duplicate and keep five. Long result labels truncate.
Notes for AI
- Import
AiSearchBarfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
AiSearchBarElinoxyn_gpui. - Props to set first:
results,answer,now. - It reads a clock (
now) for live timers; pass one clock for the whole page rather than one per component. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.