Default
The shadcn demo on a slip. Type to cut the list down ("cal"), use the arrow keys, Enter to choose. The row you are on wears the highlighter; Calculator is disabled; the last three end in a keycap.
A command palette on a slip of paper. Type and the list is sorted and cut down (cmdk's fuzzy match); the row you are on wears the highlighter, keys show as pencil keycaps, an empty search gets Stubby with his magnifier. Put it in a dialog and it is set on a napkin.
npx shadcn@latest add @wobko/commandFirst time here? Add the registry to components.json first. How to install
The shadcn demo on a slip. Type to cut the list down ("cal"), use the arrow keys, Enter to choose. The row you are on wears the highlighter; Calculator is disabled; the last three end in a keycap.
Press Ctrl + K (or Cmd + K) anywhere, or the button. The palette is set on a napkin with a pinked edge, over the dim; Escape puts it away and focus goes back to the button.
Results that come from a server: filtering is off (`shouldFilter={false}`), the loops show while a search is on its way, and Stubby comes out with his magnifier when the answer is nothing. Try "inv", then "zzz".
The classic use: a Command inside a Popover. The popover is the paper (the palette's own slip switches itself off), the chosen status gets a tick, and picking one closes the slip.
The palette (cmdk `Command`): every cmdk prop works (`value`, `onValueChange`, `filter`, `shouldFilter`, `loop`, `label`...). It lies on a slip of paper of its own, which switches itself off inside a Popover, Dialog, Card, Sheet or Drawer that already is paper. Like upstream's it is `h-full w-full`: put it in a box with a height, or pass `className="h-auto"` (in a container that only has a `min-height` WebKit resolves `100%` against that and stretches the slip).
| Prop | Type | Default | Description |
|---|---|---|---|
| sheet | boolean | { stock, edge, tilt, tape, tapeKind, shadow, seed } | true | The slip under the palette. `false` draws none; an object picks another stock (`{ stock: "napkin" }`). |
| label | string | - | Accessible name (cmdk keeps it in a screen-reader-only label). |
The palette in a Dialog, set on a napkin with a pinked edge, pinned near the top of the window (a centered sheet would move the search field under your eyes as the list grows and shrinks; `className` overrides it). The title and description are for screen readers only. Opening it with a shortcut (Ctrl / Cmd + K) is yours to wire (see the example).
| Prop | Type | Default | Description |
|---|---|---|---|
| title / description | string | "Command Palette" / "Search for a command to run..." | The dialog's accessible name and description. |
| showCloseButton | boolean | false | The corner x. Off by default (upstream: on): a palette closes with Escape or a click outside. |
| stock / edge / tape / tilt / seed | PaperProps | stock "napkin" | What the sheet is made of and how it is cut; passed to the dialog's Paper. |
| commandProps | Omit<CommandProps, 'children'> | - | Props for the Command inside (`shouldFilter`, `filter`, `loop`, `value`...). |
The search field: a magnifier, blue felt text, a double rule drawn under the row (a blue one joins it when the field has focus). One ink drawing, on the wrapper; the input is a plain direct child. A polite status says how many results are left.
| Prop | Type | Default | Description |
|---|---|---|---|
| resultsLabel | (count: number) => string | "No results" | "1 result" | "n results" | Text of the screen-reader status (translate it). It stays empty until something is typed. |
| wrapperClassName | string | - | Classes for the row around the input. |
| seed | string | number | - | Pins the hand that draws the rule. |
Shown by cmdk when nothing matches: Stubby with his magnifier and your words in script. Write it inside `CommandList` as usual; it is drawn just below the (empty) listbox so the listbox stays valid.
| Prop | Type | Default | Description |
|---|---|---|---|
| mascot | boolean | true | `false` leaves Stubby out. |
The files the CLI copies into your project.
Loading the source