Skip to content

Components

Command

A keyboard-first command menu, inline or in a dialog.

Customize
Ombelle · light

Installation

Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.

pnpm dlx @ombelle-ui/cli@1.1.2 add command

Adds components/ui/command.tsx and installs react, @radix-ui/react-dialog, cmdk, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.

In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.

Usage

example.tsx
import { Command, CommandInput, CommandList, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, CommandEmpty } from '@/components/ui/command'
export function Example(){return <Command label="Commands"><CommandInput placeholder="Search commands" /><CommandList><CommandGroup heading="Components"><CommandItem onSelect={() => {}}>Add Button<CommandShortcut>↵</CommandShortcut></CommandItem><CommandItem>Add Dialog</CommandItem></CommandGroup><CommandSeparator /><CommandGroup heading="Theme"><CommandItem>Add theme from preset<CommandShortcut>Ctrl+T</CommandShortcut></CommandItem></CommandGroup></CommandList><CommandEmpty>No results.</CommandEmpty></Command>}

API and states

API
Command (label, filter, defaultSearch), CommandDialog (open, onOpenChange, title), CommandDialogTrigger, CommandInput, CommandList, CommandGroup (heading), CommandItem (value, keywords, onSelect, disabled), CommandShortcut, CommandSeparator, CommandEmpty
Minimum states
Filtered, highlighted, empty, disabled item, dialog
Native basis
cmdk and Radix Dialog; Base UI Autocomplete and Dialog in the Base UI edition
Styles
Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.