Select
Pick one option in the text field's look: groups, icons and a second line per option, a gliding highlight, type-ahead, search and a loading state.
oxyn add selectlet options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
value: "swift",
label: "Model",
hint: "Applies to new runs",
on_change: move |id: String| model.set(id),
}
}Rendered from Rust at build time · goes live when visible
When to use
- Pick one option in the text field's look: model, region, language, fallback provider.
- Unlike the dropdown menu it holds a *value* and lives in forms.
When not to use
- One input for every form: use Text Field instead.
- Actions and choices behind any trigger: use Dropdown Menu instead.
- The model menu of an AI chat: use Model Picker instead.
Installation
Select is free and MIT. The oxyn CLI copies its code, and the components it needs, into src/oxyn/ of your Dioxus or GPUI project, so it is yours to change.
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add selectuse crate::oxyn::{Select, PRIMITIVES_CSS};Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{Select, PRIMITIVES_CSS};
Usage
let options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
value: "swift",
label: "Model",
hint: "Applies to new runs",
on_change: move |id: String| model.set(id),
}
}Examples
Closed
A value picked.
Code
let options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
value: "swift",
label: "Model",
hint: "Applies to new runs",
on_change: move |id: String| model.set(id),
}
}Open
Open with groups and second lines.
Code
let options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
value: "swift",
label: "Model",
hint: "Applies to new runs",
on_change: move |id: String| model.set(id),
}
}Searchable
A filter field on top.
Code
let options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
value: "swift",
label: "Model",
hint: "Applies to new runs",
searchable: true,
on_change: move |id: String| model.set(id),
}
}Native
The platform's own select (Oxyn plus).
Code
let options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
value: "swift",
label: "Model",
hint: "Applies to new runs",
native: true,
on_change: move |id: String| model.set(id),
}
}Error
Required, nothing chosen.
Code
let options = vec![
SelectOption::new("swift", "Claude Haiku 5").desc("Fastest · $1 / Mtok").icon("bolt").group("Anthropic"),
SelectOption::new("deep", "Claude Opus 5").desc("Deepest · $5 / Mtok").icon("brain").group("Anthropic"),
SelectOption::new("q7", "Local Q 7B").desc("Free · on device").icon("bolt").group("On device"),
];
rsx! {
Select {
options: options,
label: "Model",
hint: "Applies to new runs",
error: "Choose a fallback model",
on_change: move |id: String| model.set(id),
}
}API reference
Select
| Prop | Type | Default | Description |
|---|---|---|---|
optionsrequired | Vec<SelectOption> | — | Options. |
value | Option<String> | Default::default() | Value. |
placeholder | String | "Choose…" | Placeholder. |
label | Option<String> | Default::default() | Label. |
hint | Option<String> | Default::default() | Hint. |
error | Option<String> | Default::default() | Error. |
optional | bool | Default::default() | "Optional" next to the label. |
required | bool | Default::default() | Required. |
size | String | "md" | `sm` · `md` · `lg`. |
disabled | bool | Default::default() | Disabled. |
searchable | bool | Default::default() | Filter field. |
loading | bool | Default::default() | Options loading. |
up | bool | Default::default() | Open upward (the host passes the placement result). |
open | bool | Default::default() | Start open (review sheets). |
name | Option<String> | Default::default() | Form field name. |
native | bool | Default::default() | Oxyn plus: render a native `<select>` (mobile pickers, very long lists). |
now | ClockMs | Default::default() | Clock (type-ahead window). |
on_change | EventHandler<String> | — | Changed. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| EnterorSpaceor↓ | Open |
| ↑or↓orHomeorEnd | Move the highlight |
| Type | Jump to the next match (type-ahead) |
| Enter | Choose |
| Esc | Close without changing |
Accessibility
- The trigger is a combobox labelled by the field label and its value; the list is a listbox.
- aria-activedescendant follows the highlight, so focus stays on the trigger.
- Esc returns without changing the value.
From the spec
Trigger is a combobox button labelled by the field label + its value; the list is a listbox with options; aria-activedescendant follows the highlight so focus can stay on the trigger. A hidden input carries name / value for forms. Esc returns without changing the value.
Motion & interaction
The list fades in out of a 4 px lift from the field's edge (downward, or upward when it opens above). One highlight glides between rows on spring.snap for the pointer and jumps for keys. The chevron turns half a circle. The chosen check draws itself. The value label rises / drops with a short blur (Arc).
Timing
| Transition | Duration | Easing | Reduced motion |
|---|---|---|---|
| List open | 180 ms fade + 4 px lift | ease.out | 80 ms fade |
| Highlight glide | 214 ms spring.snap | spring | jump |
| Chevron | 180 ms | ease.out | instant |
| Value rise / drop | 180 ms, 5 px, blur 3 → 0 | ease.out | crossfade 80 ms |
| Check draw | 240 ms | ease.out | drawn |
| Type-ahead window | 500 ms | — | — |
| Error nudge | 300 ms, 4 → 1 px | linear | none |
Responsive behaviour
- The list opens upward when the host passes up (no room below).
- Long lists scroll inside a 280 px list; on narrow screens the list matches the trigger width.
Edge cases (spec)
Long option lists scroll inside a 280 px list; the highlighted row scrolls into view. A value not in the options shows the placeholder. Disabled chosen option still shows as the value. Narrow screens: the list matches the trigger width. Type-ahead skips disabled options and wraps.
Notes for AI
- Import
Selectfromoxyn_dioxusand includePRIMITIVES_CSSplus the token stylesheet once. - A GPUI version exists:
SelectElinoxyn_gpui. - Props to set first:
options. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.