A fast, filterable command menu — inline or as a ⌘K palette.
$ pnpm dlx shadcn@latest add https://dashral.com/r/command.jsonInstallation
$ pnpm dlx shadcn@latest add https://dashral.com/r/command.jsonAdds the component, the components it builds on, its npm packages and the theme tokens it uses. Using Dashral often? Add the registry to components.json once:
{
"registries": {
"@dashral": "https://dashral.com/r/{name}.json"
}
}Then add components by name:
$ pnpm dlx shadcn@latest add @dashral/commandUsage
import { Command } from "@/components/dashral/command"
<Command
placeholder="Search…"
groups={[
{
heading: "Pages",
items: [
{ label: "Dashboard", shortcut: "⌘D" },
{ label: "Customers" },
{ label: "Settings", shortcut: "⌘," },
],
},
]}
/>Examples
API reference
Command
Also takes every prop of cmdk(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
groups | { heading?, items: { label, value?, keywords?, icon?, shortcut?, badge?, disabled?, onSelect? }[] }[]The actions, in groups. Required. A shortcut is text ("⌘S") or key caps, e.g. two <Kbd> for a sequence such as G then O. | — |
placeholder | stringIn the search field. | "Search…" |
emptyText | ReactNodeShown when nothing matches. | "No results found." |
className | stringExtra classes, merged with cn() so yours win. | — |
CommandDialog
Also takes every prop of Radix Dialog(opens in a new tab).
| Prop | Type | Default |
|---|---|---|
groups / placeholder / emptyText | Like Command's. | — |
open / onOpenChange / trigger | Open it with state (e.g. on ⌘K) or a trigger. | — |
title / description | stringRead by screen readers (visually hidden). | "Command palette" |
CommandRoot / CommandInput / CommandList / CommandEmpty / CommandGroup / CommandItem / CommandSeparator / CommandShortcut
Building blocks, for a list of your own: Combobox and MultiSelect are made from them.
Keyboard
| Keys | Action |
|---|---|
| Type | Filter |
| ↓or↑ | Move through the items |
| Enter | Run the highlighted item |
| Escape | Close the dialog |
Accessibility
- The input is a combobox controlling a listbox; the highlighted item is announced as you move.