Command Palette
interlace-ui/command-paletteFreeComponent
⌘K. A modal surface holding one filterable list of actions.
Install it
npx shadcn@latest add https://ds.interlace.tools/r/command-palette.jsonSource
1'use client';23import * as React from 'react';45// @interlace/command-palette v1.0.0 — Interlace design system.6// Docs, props and live preview: https://ds.interlace.tools/c/command-palette7// What changed since: https://ds.interlace.tools/c/command-palette#history8// Generated banner — keep it, the upgrade diff reads this version.910/**11 * @interlace/ui — CommandPalette12 *13 * ⌘K. A modal surface holding one filterable list of actions.14 *15 * This is a COMPOSITION, not a new primitive: `Dialog` supplies the modal16 * (backdrop, focus trap, page inert, Escape, focus restore to the trigger),17 * and `@base-ui/react/combobox` in `inline` mode supplies the field and the18 * list (filtering, listbox ARIA, virtual focus, highlight). Neither half is19 * reimplemented here — this file is the ~200 lines of surface that sit20 * between them.21 * Mirrors: https://ui.shadcn.com/docs/components/command (`CommandDialog`)22 *23 * ## Why `inline` is load-bearing24 *25 * `inline` is not a styling flag. It is the prop that makes a combobox26 * legal inside a dialog, and Base UI's own source says so27 * (`combobox/root/AriaCombobox.js`: "Support composing the Dialog component28 * around an inline combobox"). Three things change:29 *30 * 1. No portal, no positioner. `ComboboxList` registers ITSELF as the31 * positioner element, so the list renders in the dialog's flow instead32 * of floating over it in a second portal — which is what makes the33 * panel one surface and one scroll container.34 * 2. Base UI walks `positionerElement.closest('[role="dialog"]')` to find35 * the animated element. Our panel is a `Dialog.Popup`, so it matches.36 * 3. `useDismiss` is DISABLED and Escape is allowed to bubble37 * (`bubbles: inline ? true : undefined`). Without `inline`, the38 * combobox swallows Escape to close its own popup and the dialog stays39 * open — one Escape does nothing, and the user is in a surface they40 * cannot leave from the keyboard (WCAG 2.1.2). This is the failure the41 * keyboard lock exists to catch.42 *43 * The combobox root is held `open`, controlled, forever. In `inline` mode44 * Base UI already treats the list as open internally, but the input's45 * `aria-controls` is still gated on the root's own `open` state — so leaving46 * it `false` ships a `role="combobox"` that points at nothing.47 *48 * ## Anatomy49 *50 * CommandPalette (Root) → Dialog.Root (open state)51// … truncated
More from interlace-ui
All 140 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| A11y Startera11y-starter | interlace-ui | Components | Free | no deps | |
| Accordionaccordion | interlace-ui | Components | Free | no deps | |
| Alertalert | interlace-ui | Components | Free | no deps | |
| Alert Dialogalert-dialog | interlace-ui | Components | Free | no deps | |
| Animated Gradient Textanimated-gradient-text | interlace-ui | Components | Free | no deps | |
| Animated Grid Patternanimated-grid-pattern | interlace-ui | Components | Free | no deps | |
| Animated Listanimated-list | interlace-ui | Components | Free | no deps | |
| Article Cardarticle-card | interlace-ui | Components | Free | no deps |
