Spotlight

Command palette modal overlay component featuring auto-focused search input, keyboard navigation shortcuts, and result list slot.

// Radix — @radix-ui/react-dialog
import { Spotlight } from "@shavin/ui";

Interactive Demo

Or press ⌘K / Ctrl+K
import { Spotlight, Button, Kbd, Badge } from "@shavin/ui";

function CommandPalette() {
  const [open, setOpen] = useState(false);
  const [query, setQuery] = useState("");

  return (
    <>
      <Button variant="ghost" onClick={() => setOpen(true)}>
        <span>Search</span>
        <Kbd>⌘K</Kbd>
      </Button>

      <Spotlight
        open={open}
        onOpenChange={setOpen}
        query={query}
        onQueryChange={setQuery}
        placeholder="Type to search..."
      >
        {/* Render grouped search suggestions */}
      </Spotlight>
    </>
  );
}
PropTypeDefault
open*boolean
onOpenChange*(open: boolean) => void
query*string
onQueryChange*(query: string) => void
onKeyDown(e: React.KeyboardEvent<HTMLInputElement>) => void
placeholderstring
childrenReactNode
footerReactNode
classNamestring

* required

KeyAction
ArrowDownHighlight next search result item
ArrowUpHighlight previous search result item
EnterSelect highlighted result item and execute action
EscapeDismiss Spotlight modal
Configure Theme
Theme
Accent Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font