Components

A command palette for quick access to actions and navigation, often used for keyboard shortcuts.

Installation

npm install @mijn-ui/react-command

Usage

import {
  Command,
  CommandDialog,
  CommandEmpty,
  CommandGroup,
  CommandInput,
  CommandItem,
  CommandList,
  CommandSeparator,
  CommandShortcut,
} from "@mijn-ui/react-command"
<Command>
  <CommandInput placeholder="Type a command or search..." />
  <CommandList>
    <CommandEmpty>No results found.</CommandEmpty>
    <CommandGroup heading="Suggestions">
      <CommandItem>Calendar</CommandItem>
      <CommandItem>Search Emoji</CommandItem>
      <CommandItem>Calculator</CommandItem>
    </CommandGroup>
    <CommandSeparator />
    <CommandGroup heading="Settings">
      <CommandItem>Profile</CommandItem>
      <CommandItem>Billing</CommandItem>
      <CommandItem>Settings</CommandItem>
    </CommandGroup>
  </CommandList>
</Command>

Examples

Command Dialog

Press J

Command Palette

Search for a command to run...


API Reference

Standard element attributes are forwarded to the underlying component in addition to the props below.

PropTypeDefaultDescription
unstyledbooleanfalseOpt out of the default styles to fully customize the component.
classNamesobjectOverride classes per slot (see Style Slots below).
classNamestringAdditional classes for the root element.

Command Style Slots

Slot NameTargeted ComponentPurpose
baseCommandStyles the root Command component.
dialogWrapperCommandDialogStyles the command dialog Wrapper.
dialogCommandDialogStyles the command dialog.
groupCommandGroupStyles the groups inside the command.
listCommandListStyles the command list.
itemCommandItemStyles individual command items.
separatorCommandSeparatorStyles separators inside the command list.
shortcutCommandShortcutStyles shortcut text inside commands.
emptyCommandEmptyStyles the state when the command list is empty.
inputCommandInputStyles the input field of the command.