Installation
Complete project setup first. Your configuration
must select react/base and include your Design System ID.
pnpm exec frontfriend download command -f react --primitive baseReview dependencies reported by the downloader and keep your source changes in version control.
Usage
import {
Command,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
} from "@/components/ui/command";
<Command
label="Quick actions"
shouldFilter
className="w-80 rounded-lg border"
>
<CommandInput placeholder="Search actions..." />
<CommandList>
<CommandEmpty>No results.</CommandEmpty>
<CommandGroup heading="Actions">
<CommandItem>Copy</CommandItem>
<CommandItem>Paste</CommandItem>
<CommandItem>Delete</CommandItem>
</CommandGroup>
</CommandList>
</Command>; Examples
Basic
import { Button } from "@/components/ui/button";
import {
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
} from "@/components/ui/command";
import * as React from "react";
export default function CommandExample() {
const [open, setOpen] = React.useState(false);
return (
<div className="flex flex-col gap-4">
<Button
onClick={() => setOpen(true)}
variant="tertiary"
className="w-fit"
>
Open Menu
</Button>
<CommandDialog open={open} onOpenChange={setOpen}>
<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>
</CommandList>
</CommandDialog>
</div>
);
} Shortcuts
import { Button } from "@/components/ui/button";
import {
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandShortcut,
} from "@/components/ui/command";
import { UserIcon, CreditCardIcon, SettingsIcon } from "lucide-react";
import * as React from "react";
export default function CommandExample() {
const [open, setOpen] = React.useState(false);
return (
<div className="flex flex-col gap-4">
<Button
onClick={() => setOpen(true)}
variant="tertiary"
className="w-fit"
>
Open Menu
</Button>
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Settings">
<CommandItem>
<UserIcon />
<span>Profile</span>
<CommandShortcut>⌘P</CommandShortcut>
</CommandItem>
<CommandItem>
<CreditCardIcon />
<span>Billing</span>
<CommandShortcut>⌘B</CommandShortcut>
</CommandItem>
<CommandItem>
<SettingsIcon />
<span>Settings</span>
<CommandShortcut>⌘S</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</CommandDialog>
</div>
);
} Groups
import { Button } from "@/components/ui/button";
import {
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command";
import {
CalendarIcon,
SmileIcon,
CalculatorIcon,
UserIcon,
CreditCardIcon,
SettingsIcon,
} from "lucide-react";
import * as React from "react";
export default function CommandExample() {
const [open, setOpen] = React.useState(false);
return (
<div className="flex flex-col gap-4">
<Button
onClick={() => setOpen(true)}
variant="tertiary"
className="w-fit"
>
Open Menu
</Button>
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Suggestions">
<CommandItem>
<CalendarIcon />
<span>Calendar</span>
</CommandItem>
<CommandItem>
<SmileIcon />
<span>Search Emoji</span>
</CommandItem>
<CommandItem>
<CalculatorIcon />
<span>Calculator</span>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>
<UserIcon />
<span>Profile</span>
<CommandShortcut>⌘P</CommandShortcut>
</CommandItem>
<CommandItem>
<CreditCardIcon />
<span>Billing</span>
<CommandShortcut>⌘B</CommandShortcut>
</CommandItem>
<CommandItem>
<SettingsIcon />
<span>Settings</span>
<CommandShortcut>⌘S</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</CommandDialog>
</div>
);
} Scrollable
import { Button } from "@/components/ui/button";
import {
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandShortcut,
CommandSeparator,
} from "@/components/ui/command";
import {
HomeIcon,
InboxIcon,
FileTextIcon,
FolderIcon,
PlusIcon,
FolderPlusIcon,
CopyIcon,
ScissorsIcon,
ClipboardPasteIcon,
TrashIcon,
LayoutGridIcon,
ListIcon,
ZoomInIcon,
ZoomOutIcon,
UserIcon,
CreditCardIcon,
SettingsIcon,
BellIcon,
HelpCircleIcon,
CalculatorIcon,
CodeIcon,
ImageIcon,
} from "lucide-react";
import * as React from "react";
export default function CommandExample() {
const [open, setOpen] = React.useState(false);
return (
<div className="flex flex-col gap-4">
<Button
onClick={() => setOpen(true)}
variant="tertiary"
className="w-fit"
>
Open Menu
</Button>
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Navigation">
<CommandItem>
<HomeIcon />
<span>Home</span>
<CommandShortcut>⌘H</CommandShortcut>
</CommandItem>
<CommandItem>
<InboxIcon />
<span>Inbox</span>
<CommandShortcut>⌘I</CommandShortcut>
</CommandItem>
<CommandItem>
<FileTextIcon />
<span>Documents</span>
<CommandShortcut>⌘D</CommandShortcut>
</CommandItem>
<CommandItem>
<FolderIcon />
<span>Folders</span>
<CommandShortcut>⌘F</CommandShortcut>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Actions">
<CommandItem>
<PlusIcon />
<span>New File</span>
<CommandShortcut>⌘N</CommandShortcut>
</CommandItem>
<CommandItem>
<FolderPlusIcon />
<span>New Folder</span>
<CommandShortcut>⇧⌘N</CommandShortcut>
</CommandItem>
<CommandItem>
<CopyIcon />
<span>Copy</span>
<CommandShortcut>⌘C</CommandShortcut>
</CommandItem>
<CommandItem>
<ScissorsIcon />
<span>Cut</span>
<CommandShortcut>⌘X</CommandShortcut>
</CommandItem>
<CommandItem>
<ClipboardPasteIcon />
<span>Paste</span>
<CommandShortcut>⌘V</CommandShortcut>
</CommandItem>
<CommandItem>
<TrashIcon />
<span>Delete</span>
<CommandShortcut>⌫</CommandShortcut>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="View">
<CommandItem>
<LayoutGridIcon />
<span>Grid View</span>
</CommandItem>
<CommandItem>
<ListIcon />
<span>List View</span>
</CommandItem>
<CommandItem>
<ZoomInIcon />
<span>Zoom In</span>
<CommandShortcut>⌘+</CommandShortcut>
</CommandItem>
<CommandItem>
<ZoomOutIcon />
<span>Zoom Out</span>
<CommandShortcut>⌘-</CommandShortcut>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Account">
<CommandItem>
<UserIcon />
<span>Profile</span>
<CommandShortcut>⌘P</CommandShortcut>
</CommandItem>
<CommandItem>
<CreditCardIcon />
<span>Billing</span>
<CommandShortcut>⌘B</CommandShortcut>
</CommandItem>
<CommandItem>
<SettingsIcon />
<span>Settings</span>
<CommandShortcut>⌘S</CommandShortcut>
</CommandItem>
<CommandItem>
<BellIcon />
<span>Notifications</span>
</CommandItem>
<CommandItem>
<HelpCircleIcon />
<span>Help & Support</span>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Tools">
<CommandItem>
<CalculatorIcon />
<span>Calculator</span>
</CommandItem>
<CommandItem>
<CodeIcon />
<span>Code Editor</span>
</CommandItem>
<CommandItem>
<ImageIcon />
<span>Image Viewer</span>
</CommandItem>
</CommandGroup>
</CommandList>
</CommandDialog>
</div>
);
} Keyboard Shortcut
import {
CommandDialog,
CommandInput,
CommandList,
CommandEmpty,
CommandGroup,
CommandItem,
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command";
import {
CalendarIcon,
SmileIcon,
CalculatorIcon,
UserIcon,
CreditCardIcon,
SettingsIcon,
} from "lucide-react";
import * as React from "react";
export default function CommandExample() {
const [open, setOpen] = React.useState(false);
React.useEffect(() => {
const down = (event: KeyboardEvent) => {
if (event.key === "j" && (event.metaKey || event.ctrlKey)) {
event.preventDefault();
setOpen((currentOpen) => !currentOpen);
}
};
document.addEventListener("keydown", down);
return () => document.removeEventListener("keydown", down);
}, []);
return (
<>
<p className="text-sm text-neutral-subtle">
Press{" "}
<kbd className="pointer-events-none inline-flex h-5 items-center gap-1 rounded border border-neutral-subtle bg-layer-control px-1.5 font-mono text-[10px] font-medium text-neutral-subtle opacity-100 select-none">
<span className="text-xs">⌘</span>J
</kbd>
</p>
<CommandDialog open={open} onOpenChange={setOpen}>
<CommandInput placeholder="Type a command or search..." />
<CommandList>
<CommandEmpty>No results found.</CommandEmpty>
<CommandGroup heading="Suggestions">
<CommandItem>
<CalendarIcon />
<span>Calendar</span>
</CommandItem>
<CommandItem>
<SmileIcon />
<span>Search Emoji</span>
</CommandItem>
<CommandItem>
<CalculatorIcon />
<span>Calculator</span>
</CommandItem>
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Settings">
<CommandItem>
<UserIcon />
<span>Profile</span>
<CommandShortcut>⌘P</CommandShortcut>
</CommandItem>
<CommandItem>
<CreditCardIcon />
<span>Billing</span>
<CommandShortcut>⌘B</CommandShortcut>
</CommandItem>
<CommandItem>
<SettingsIcon />
<span>Settings</span>
<CommandShortcut>⌘S</CommandShortcut>
</CommandItem>
</CommandGroup>
</CommandList>
</CommandDialog>
</>
);
} API reference
Frontfriend-owned props. Native HTML and inherited primitive props remain documented by Base UI.
| Prop | Type | Default | Description |
|---|---|---|---|
description | string | "Search for a command to run..." | |
showCloseButton | boolean | false | |
title | string | "Command Palette" |
Configuration determines the actual classes and available styling hooks. See Theming & component configuration before introducing a repeated local override.