StealThis .dev

SaaS — Global Command Bar (⌘K)

A polished, accessible global command bar overlay for SaaS apps, opened with Cmd-K or Ctrl-K. It pairs a search input with grouped results for Navigation, Actions, Recent, and Settings, plus fuzzy matching with highlighted hits, full keyboard navigation via arrows, Enter and Esc, a focus trap, action icons and shortcut hints, a working dark-theme toggle, and a recent-commands list that updates as you go. Built with vanilla JS, no libraries.

Open in Lab
html css vanilla-js
Targets: JS HTML

Code

Global Command Bar (⌘K)

A drop-in command palette for SaaS dashboards. Press ⌘K / Ctrl-K anywhere — or click the search field in the top bar — to summon a centered overlay with a focused search input and grouped results. Commands are organized into Recent, Navigation, Actions, and Settings, each row showing an icon, a subtitle, and keyboard-shortcut hints.

Typing runs a lightweight fuzzy matcher: it prefers title substrings, falls back to keyword matches, then to subsequence scoring, and highlights the matched characters inline. Navigation is fully keyboard-driven — ↑/↓ move the selection, Enter runs the highlighted command, and Esc closes the palette. The overlay traps focus while open and restores it to the trigger on close. Selecting a command fires a real demo action: navigation commands toast their destination, the theme command actually toggles a dark palette, and every choice is pushed onto the Recent list shown the next time you open the bar.

Everything is self-contained vanilla HTML, CSS, and JavaScript with no frameworks or external libraries, so you can lift the pattern straight into your own product shell.

Illustrative SaaS UI only — fictional product, metrics, and billing. No real backend.