Search fieldPro
A search input whose clear button scales in inside a reserved slot so the width never shifts; with items it filters live under a gliding highlight and shows an empty state.
oxyn add search-fieldThe 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
- Filter a list or start a search: settings pages, files, members.
- The field must not jump when the clear button appears, and Escape must clear.
When not to use
- An icon that morphs into a search field with grouped, highlighted results beneath: use Expanding search instead.
- One search card for an app or docs: use AI search bar instead.
- Search and run anything from one field: use Command palette instead.
Installation
Search field 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 search-fieldUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Filter
Live filtering.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Plain
A field with the clear button.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Scoped ai
Scope chips and an Ask AI row.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Empty
No results.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
SearchField
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | String | — | Label. |
value | String | Default::default() | Initial value. |
placeholder | String | "Search" | Placeholder. |
hide_label | bool | Default::default() | Visually hide the label. |
size | String | "md" | `sm` · `md` · `lg`. |
disabled | bool | Default::default() | Disabled. |
items | Vec<String> | Default::default() | Items to filter live. |
scopes | Vec<String> | Default::default() | Scope chips (Oxyn plus). |
ask_ai | bool | Default::default() | "Ask AI" row for the query (Oxyn plus). |
width | f32 | 320.0 | Width px. |
on_change | EventHandler<String> | — | Value changed. |
on_pick | EventHandler<String> | — | A result picked. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| Esc | Clear the field |
Accessibility
- A native search input with a real label; the clear button is labelled and hands focus back.
- Result counts are announced politely.
From the spec
A real <label>; the clear button is labelled "Clear search" and returns focus to the input. Result counts are announced politely.
Motion & interaction
The clear button scales in with a spring and presses to 0.96. A single highlight glides between result rows under the pointer.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Clear in | 200 ms | spring | none |
| Highlight glide | 214 ms | spring | 80 ms fade |
Responsive behaviour
- The clear slot is reserved; the field shrinks with min-width 0.
Edge cases (spec)
Long values scroll inside the input. Results cap at 220 px and scroll. The clear slot is always reserved so the width never shifts.
Notes for AI
- Import
SearchFieldfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
SearchFieldElinoxyn_gpui. - Props to set first:
label. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.