Expanding searchPro
An icon that morphs into a search field with grouped, highlighted results beneath; the panel tracks the field's width; Enter picks and folds it back.
oxyn add expanding-searchThe 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
- A search that takes no room until needed: an icon in a toolbar that becomes a field with results, then folds back after a pick.
When not to use
- A search input whose clear button scales in inside a reserved slot so the width never shifts: use Search field instead.
- Search and run anything from one field: use Command palette instead.
- An app sidebar: use Sidebar instead.
Installation
Expanding search 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 expanding-searchUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Results
Expanded with results.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Recent
Expanded, recent searches.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Icon
Folded into its icon.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Start
Grows to the right.
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
ExpandingSearch
| Prop | Type | Default | Description |
|---|---|---|---|
labelrequired | String | — | Names the button, field and results. |
itemsrequired | Vec<Command> | — | Items (group = section). |
suggestions | Vec<Command> | Default::default() | Shown before typing. |
suggestions_label | String | "Recent" | Heading for suggestions. |
placeholder | Option<String> | Default::default() | Placeholder (defaults to the label). |
expanded_width | f32 | 360.0 | Widest the field grows px. |
max_results | usize | 6 | Most results. |
anchor | String | "end" | `start` · `center` · `end`. |
empty_hint | String | "Try a shorter word or check the spelling." | Tip under the empty state. |
default_expanded | bool | Default::default() | Start expanded. |
query | String | Default::default() | Initial query. |
hotkey | bool | Default::default() | ⌘K expands it (while focus is inside the host). |
lane | f32 | 420.0 | Lane width px (the container it grows in). |
on_select | EventHandler<String> | — | Picked (id). |
on_expanded_change | EventHandler<bool> | — | Expanded changed. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpace | On the icon: expand |
| ↑or↓ | Move (wraps) |
| Enter | Pick |
| Esc | Fold back |
| ⌘K | Expand (Oxyn plus) |
Accessibility
- Combobox with aria-activedescendant over a listbox of labelled groups.
- Counts and empty states are announced; the folded field is not in the tab order.
From the spec
The icon is a labelled button; the field is a combobox with aria-activedescendant; groups are labelled; counts are announced.
Motion & interaction
The icon morphs into the field: width grows with a soft spring away from the anchor and corners square off; the panel drops in and tracks the field width.
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| Expand / fold | 380 ms | spring (1.15) | instant |
| Panel in | 240 ms | ease.out | fade |
Responsive behaviour
- Grows to the smaller of its width and its container; the panel caps at min(22 rem, 60 vh).
Edge cases (spec)
The field never grows past its container. Results cap at min(22 rem, 60 vh). Folding clears the query.
Notes for AI
- Import
ExpandingSearchfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
ExpandingSearchElinoxyn_gpui. - Props to set first:
label,items. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.