Dashral Pro is on the wayGet 30% off at launch

Dashral

Command

A fast, filterable command menu — inline or as a ⌘K palette.

$ pnpm dlx shadcn@latest add https://dashral.com/r/command.json

Installation

$ pnpm dlx shadcn@latest add https://dashral.com/r/command.json

Adds 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:

components.json
{
  "registries": {
    "@dashral": "https://dashral.com/r/{name}.json"
  }
}

Then add components by name:

$ pnpm dlx shadcn@latest add @dashral/command

Usage

example.tsx
import { Command } from "@/components/dashral/command"

<Command
  placeholder="Search…"
  groups={[
    {
      heading: "Pages",
      items: [
        { label: "Dashboard", shortcut: "⌘D" },
        { label: "Customers" },
        { label: "Settings", shortcut: "⌘," },
      ],
    },
  ]}
/>

Examples

Command palette

Toggle with a keyboard shortcut. Try ⌘J / Ctrl+J.

Pages

“Change theme…” opens its own list in the same box; Backspace in the empty search goes back.

Try “Change theme…”, then Backspace to go back.

API reference

Command

Also takes every prop of cmdk(opens in a new tab).

PropTypeDefault
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.

—
placeholderstring

In the search field.

"Search…"
emptyTextReactNode

Shown when nothing matches.

"No results found."
classNamestring

Extra classes, merged with cn() so yours win.

—

CommandDialog

Also takes every prop of Radix Dialog(opens in a new tab).

PropTypeDefault
groups / placeholder / emptyText

Like Command's.

—
open / onOpenChange / trigger

Open it with state (e.g. on ⌘K) or a trigger.

—
title / descriptionstring

Read 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

KeysAction
TypeFilter
↓or↑Move through the items
EnterRun the highlighted item
EscapeClose the dialog

Accessibility

  • The input is a combobox controlling a listbox; the highlighted item is announced as you move.