Skip to content
Back

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-field
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

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.

Terminal
oxyn add search-field

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Filter

Live filtering.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Plain

A field with the clear button.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Scoped ai

Scope chips and an Ask AI row.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Empty

No results.

Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

SearchField

PropTypeDefaultDescription
labelrequiredString—Label.
valueStringDefault::default()Initial value.
placeholderString"Search"Placeholder.
hide_labelboolDefault::default()Visually hide the label.
sizeString"md"`sm` · `md` · `lg`.
disabledboolDefault::default()Disabled.
itemsVec<String>Default::default()Items to filter live.
scopesVec<String>Default::default()Scope chips (Oxyn plus).
ask_aiboolDefault::default()"Ask AI" row for the query (Oxyn plus).
widthf32320.0Width px.
on_changeEventHandler<String>—Value changed.
on_pickEventHandler<String>—A result picked.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
EscClear 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
TransitionDurationEasingReduced motion
Clear in200 msspringnone
Highlight glide214 msspring80 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 SearchField from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: SearchFieldEl in oxyn_gpui.
  • Props to set first: label.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI