NavigationAvailable

Command

Searchable command list with keyboard selection and empty results.

Loading example…

Installation

Add the component and its dependencies from the registry running on your computer.

terminal
npx shadcn@latest add https://brutallab.facilito.dev/r/command.json

Usage

Import the component into your project and keep the source code under your control.

tsx
'use client';

import { useState } from 'react';
import {
  Command,
  CommandInput,
  CommandList,
  CommandEmpty,
  CommandGroup,
  CommandItem,
} from '@/components/ui/command';

export default function Demo() {
  const [result, setResult] = useState('Choose an action.');
  return (
    <div className="grid w-full max-w-md gap-4">
      <Command>
        <CommandInput placeholder="Find an action" />
        <CommandList>
          <CommandEmpty>No action found.</CommandEmpty>
          <CommandGroup heading="Workspace">
            <CommandItem onSelect={() => setResult('New document selected')}>
              New document
            </CommandItem>
            <CommandItem onSelect={() => setResult('Settings selected')}>
              Settings
            </CommandItem>
          </CommandGroup>
        </CommandList>
      </Command>
      <output className="bl-type-small">{result}</output>
    </div>
  );
}

States & interaction

Appearance, behavior and keyboard checks.

  • Check closed, open, highlighted, selected and disabled states where supported.
  • Dialogs and menus must open from the keyboard. Escape closes non-persistent overlays and returns focus to the trigger. Tooltips and hover cards must also appear on focus.
  • Test the example with Tab and Shift+Tab. Focus must stay visible in both themes.

API Reference

BrutalLab-specific properties. Native attributes are supported as well.

PropTypeDefaultDescription
(value: string) => void—Runs the chosen action.

Accessibility

Rules that should remain intact when adapting the component to a product.

Give the search input a meaningful label and describe command effects.

Retain keyboard focus styles and test the composition with keyboard navigation.

Use className for visual customization; preserve the primitive ARIA attributes.