Skip to content
Back

Command palette

Search and run anything from one field: every word must match, matched letters in medium weight, a gliding highlight, Tab jumps sections. The menu variant adds tool logos, ⌘1–⌘5 and a tray.

oxyn add command-palette
MCP
Dioxus
let items = vec![
    Command::new("sum", "Summarize this thread").group("Suggestions").logo("AI").suggested(),
    Command::new("new", "New thread").group("General").icon("plus").shortcut("Mod+N"),
    Command::new("settings", "Open settings").group("Go to").icon("cog").desc("Preferences and API keys"),
];

rsx! {
    CommandPalette {
        items: items,
        variant: "menu",
        auto_focus: true,
        on_select: move |(id, query)| run(id, query),
        on_close: move |_| open.set(false),
    }
}

Rendered from Rust at build time · goes live when visible

When to use

  • (⌘K), OpenCode (Ctrl+P), Zed (thread switcher Ctrl+Tab), Conductor (⌘K in workspace) (note 03); Hoplite "Jump to anything…" where opening a thread puts the cursor into its message box (note 10); Codex app has a command-palette theme switcher (note 08).
  • In an agent app half the queries are not commands but questions ("how do I rerun the failed tests?", "where is the auth middleware?").
  • The user wants one box: type, get the command if it exists, otherwise ask the agent and get a short answer without leaving what they were doing — with a button that does the thing. done and needs approval.
  • Codex's pet overlay gives lifetimes per state: Running→"Thinking" 3 min, Waiting→"Needs input" 24 h, Review→"Ready" 7 d, Failed→"Blocked" 1 h.

When not to use

  • Type @ to mention people, files and agents or / for commands: use Mention input instead.
  • The model menu of an AI chat: use Model Picker instead.
  • Markdown that renders correctly while it streams: use Streaming markdown instead.

Installation

Command palette 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.

Terminal
cargo install --git https://github.com/ismailqureshi72/Oxyn oxyn-cli
oxyn init
oxyn add command-palette
Rust
use crate::oxyn::{CommandPalette, PRIMITIVES_CSS};

Rather depend on the crate? cargo add oxyn-dioxus oxyn-core --git https://github.com/ismailqureshi72/Oxyn, then use oxyn_dioxus::{CommandPalette, PRIMITIVES_CSS};

Usage

Dioxus · rust
let items = vec![
    Command::new("sum", "Summarize this thread").group("Suggestions").logo("AI").suggested(),
    Command::new("new", "New thread").group("General").icon("plus").shortcut("Mod+N"),
    Command::new("settings", "Open settings").group("Go to").icon("cog").desc("Preferences and API keys"),
];

rsx! {
    CommandPalette {
        items: items,
        variant: "menu",
        auto_focus: true,
        on_select: move |(id, query)| run(id, query),
        on_close: move |_| open.set(false),
    }
}

Examples

Command menu

Menu: logos, ⌘1–⌘5, tray.

Code
let items = vec![
    Command::new("sum", "Summarize this thread").group("Suggestions").logo("AI").suggested(),
    Command::new("new", "New thread").group("General").icon("plus").shortcut("Mod+N"),
    Command::new("settings", "Open settings").group("Go to").icon("cog").desc("Preferences and API keys"),
];

rsx! {
    CommandPalette {
        items: items,
        variant: "menu",
        auto_focus: true,
        on_select: move |(id, query)| run(id, query),
        on_close: move |_| open.set(false),
    }
}

Palette

A palette with matched letters.

Share project
1 result
Code
let items = vec![
    Command::new("sum", "Summarize this thread").group("Suggestions").logo("AI").suggested(),
    Command::new("new", "New thread").group("General").icon("plus").shortcut("Mod+N"),
    Command::new("settings", "Open settings").group("Go to").icon("cog").desc("Preferences and API keys"),
];

rsx! {
    CommandPalette {
        items: items,
        auto_focus: true,
        on_select: move |(id, query)| run(id, query),
        on_close: move |_| open.set(false),
    }
}

Files scope

@ narrows to files.

Code
let items = vec![
    Command::new("sum", "Summarize this thread").group("Suggestions").logo("AI").suggested(),
    Command::new("new", "New thread").group("General").icon("plus").shortcut("Mod+N"),
    Command::new("settings", "Open settings").group("Go to").icon("cog").desc("Preferences and API keys"),
];

rsx! {
    CommandPalette {
        items: items,
        variant: "menu",
        auto_focus: true,
        on_select: move |(id, query)| run(id, query),
        on_close: move |_| open.set(false),
    }
}

No results

Ask the assistant instead.

Code
let items = vec![
    Command::new("sum", "Summarize this thread").group("Suggestions").logo("AI").suggested(),
    Command::new("new", "New thread").group("General").icon("plus").shortcut("Mod+N"),
    Command::new("settings", "Open settings").group("Go to").icon("cog").desc("Preferences and API keys"),
];

rsx! {
    CommandPalette {
        items: items,
        variant: "menu",
        auto_focus: true,
        on_select: move |(id, query)| run(id, query),
        on_close: move |_| open.set(false),
    }
}

API reference

CommandPalette

PropTypeDefaultDescription
itemsrequiredVec<Command>—Commands.
variantString"palette"`palette` · `menu`.
placeholderString"Type a command or search…"Placeholder.
labelString"Command palette"Hidden label for the input.
auto_focusboolDefault::default()Focus the field on mount.
queryStringDefault::default()Initial query.
scopesbooltrueScoped modes by prefix.
ask_fallbackbooltrue"Ask the assistant" row when nothing matches.
footerbooltrueFooter with key hints.
elevatedboolDefault::default()Floating shadow (inside a dialog).
max_heightf32342.0Results max height px.
widthf32560.0Width px.
nowClockMsDefault::default()Clock (the tray line fades after a while).
on_selectEventHandler<(String, String)>—A command ran (id, query).
on_askEventHandler<String>—The assistant was asked.
on_closeEventHandler<()>—Escape on an empty field.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
↑or↓Move through all sections (wraps)
HomeorEndFirst / last
TaborShiftTabNext / previous section
EnterRun the highlighted command
⌘1–⌘5Run a suggestion
EscClear the field, then close
> @ #Commands, files, threads

Accessibility

  • The field is a combobox controlling a listbox; the highlighted row is aria-activedescendant, so focus never leaves the field.
  • Groups are labelled; shortcut caps are hidden from screen readers; the result count and what ran are announced politely.
From the spec
  • Palette: role="dialog" aria-modal="true" labelled "Command palette"; input role="combobox" with aria-expanded, aria-controls the listbox, aria-activedescendant the highlighted option; groups are group with labels; matched characters are not announced separately. Result count announced politely ("8 results") debounced 500 ms.
  • Ask row: option named "Ask the agent: how do I rerun failed tests". The answer pane is a region "Agent answer" with aria-busy while streaming; the answer is not streamed into a live region — one polite announcement "Answer ready" (or "Answer stopped") with the first sentence; the user reads the rest with arrow keys after Tab moves focus into the pane.
  • Chips: buttons in a toolbar "Answer actions"; acting chips name their effect ("Run cargo test in a new terminal").
  • Notification centre: popover dialog; list of articles with headings; unread state in the name ("Unread. Researcher wants to run rm -rf dist. 2 minutes ago."). Toasts: polite live region with a hidden type prefix ("Needs you:", "Error:"); assertive only for needs-you; toasts never steal focus; F6 reaches the toast region (workspace-chrome.md §8); when a focused toast closes, focus moves to the next toast or back to where it came from.
  • Contrast: text ≥ 4.5:1, unread dot ≥ 3:1 plus bold title; states carry glyph + word.
  • Reduced motion: §6 last row.

Motion & interaction

  • Open. Scrim fades; palette rises 8 px + scale 0.98 → 1 with spring.snap; input is focused on the first frame (Hoplite "the view is there on press", note 10). Opens on key down.
  • Typing. List frame springs to the new height; rows glide when the shift is ≤ 8 rows and snap on long Jumps; one gliding highlight follows ↑↓ on spring.snap (behaviour as studied in A palette, note 12, re-implemented).
  • Ask row promotion. When the query becomes a question the ask row moves to the top with a 160 ms glide and its ✦ glyph does one soft shimmer (text-shimmer.md calm).
  • Asking. The ask row's text flies into the answer pane header (dur.travel ≤ 260 ms); the pane opens with height spring.snap; tokens render through streaming-markdown.md with a trailing caret; the palette grows to at most 12 answer lines, then the answer scrolls inside (follow on, same rule as terminal-output follow).
  • Chips. Arrive after the answer completes (never while streaming, so they don't jump): 4 px rise + fade, 40 ms stagger, cap 4. Running a chip morphs it into a loader pill, then ✓ and the palette closes after 600 ms.
  • Stop. Caret freezes, answer keeps what arrived, label "Stopped"; no shake.
  • Close. 120 ms fade + 4 px drop; focus returns to the element that had it.
  • Toast in. Rises from its own height at the screen edge, older toasts tuck behind as a fanned stack (peek 12 px, scale step 0.05) — idea from A toast stack (note 12), our numbers.
  • Centre entry arrival (centre open): new row slides in at the top of its group with a 600 ms accent tint; the 🔔 count rolls.
  • Resolve. Action button morphs to "Approved ✓" (crossfade 160 ms), row dims after 1.2 s.
  • Swipe (touch): right to dismiss with velocity throw; left rubber-bands.
Timing
TransitionDurationDelayEasing / springStaggerFrame rate
Palette open (scrim / panel)120 ms / ~180 ms0 (on key down)ease.out / spring.snap—60 Hz
Palette close120 ms0ease.in—60 Hz
Results reflow≤ 180 ms glide; snap > 8 rows0spring.snap—60 Hz
Highlight glide~120 ms0spring.snap—60 Hz
Async "Searching…" row120 ms fade150 msease.out—30 Hz shimmer
Ask row promotion160 ms0ease.in-out—60 Hz
Question fly to pane≤ 260 ms0ease.in—60 Hz
Answer pane open~200 ms0spring.snap—60 Hz
Streaming paintper streaming-markdown———≤ 30 Hz
Stall softramp 2 sstall_soft (default 8 s, proposed)OKLab linear—30 Hz
Chips in160 ms, 4 px riseafter doneease.out40 ms, cap 460 Hz
Chip run → closeloader, ✓ 160 ms, close after 600 ms—spring.snap—60 Hz
Toast in / out200 ms / 160 ms; hold 5 s (done), sticky (needs you, failed)0ease.out / ease.in—60 Hz
Toast stack fan~220 ms0spring.soft—60 Hz
Centre row arrival tint200 ms slide + 600 ms tint0spring.snap / ease.out—60 Hz
Resolve morph / dim160 ms / after 1.2 s—ease.out—60 Hz
Reduced motionpalette and toasts appear / disappear with an 80 ms opacity fade; no scale, rise, glide, fly, fan or shimmer; highlight jumps; answer still streams (information) but without caret blink; chips appear at once—linearnonestreaming ≤ 30 Hz

Responsive behaviour

  • Fills its container up to its width; under 480 px shortcut keys and hints are hidden.
Edge cases (spec)
  • Command vs question ambiguity ("test"): command wins; the ask row stays last; pressing Tab always asks, so the user is never trapped.
  • Destructive commands: rows marked destructive ask for confirmation in the row ("Press ↵ again to delete thread"), 3 s window.
  • Very long answers / code: 12 lines, then inner scroll; code blocks have their own copy; "Continue in thread" carries the full answer.
  • Answer refers to stale state: chips that target files or commands that no longer exist are disabled with "No longer available".
  • Closing while streaming: the answer keeps streaming into a "Palette answer" notification entry only if the app enables it; otherwise Esc stops it. Default: Esc once stops, Esc twice closes.
  • Secrets in query (pasted token): the app's redactor runs before sending; the ask row warns "Looks like a secret — remove before asking".
  • Large catalogues (10k files): async sources stream results in; the list never reorders items the pointer is over (pointer-stable ranking for 300 ms).
  • IME composition: no filtering until composition ends; Enter during composition never runs a command.
  • Notification floods (50 events / min): coalesce per thread; toast rate limit 1 per 2 s; the rest go straight to the centre with a count.
  • Stale needs-you (run ended): entry becomes Expired; acting on it is rejected with "This request has ended" (Hoplite clears stale approvals, note 10).
  • Multiple windows: one centre per app; toasts show only in the focused window.
  • RTL: palette mirrors; shortcut keycaps keep LTR order; toast stack anchors bottom-left.
  • Tiny sizes: palette min width 320 px; group headers hide under 400 px; bell at 16 px shows a dot, not a number.
  • Touch: rows 48 px; chips 44 px; swipe on toasts.
  • Slow networks: answer Submitted pulse ≤ 500 ms then shimmer "Asking…"; Offline state offers to queue the question as a thread message.
  • Very fast agents: answers that complete in < 300 ms render at once without the streaming caret.

Notes for AI

  • Import CommandPalette from oxyn_dioxus and include PRIMITIVES_CSS plus the token stylesheet once.
  • A GPUI version exists: CommandPaletteEl in oxyn_gpui.
  • Props to set first: items.
  • 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