✨ Working with PDFs, images or videos? Discover 145+ free web apps built for everyday tasks

Command

Provides fast searchable actions and navigation interfaces.

Loading preview...

Examples

Practical examples and common states for the same installable component.

Grouped

Organizes commands into labeled categories.

examples/command-grouped.tsx
import { Command, type CommandGroup } from "@/components/wensity/command";
const groups: CommandGroup[] = [
{
heading: "Pages",
items: [
{ id: "dashboard", label: "Dashboard" },
{ id: "customers", label: "Customers" },
{ id: "files", label: "Files" },
],
},
{
heading: "Actions",
items: [
{ id: "invite", label: "Invite teammate" },
{ id: "export", label: "Export data" },
],
},
{
heading: "Preferences",
items: [{ id: "settings-preferences", label: "Settings", shortcut: ["⌘", ","] }],
},
];
export function CommandGrouped() {
return <Command groups={groups} showHints={false} />;
}

Recent

Surfaces recently used commands and actions above the full list.

examples/command-recent.tsx
import { IconClock, IconFolder, IconSettings, IconUser } from "@tabler/icons-react";
import { Command, type CommandGroup } from "@/components/wensity/command";
const groups: CommandGroup[] = [
{
heading: "Recent",
items: [
{ id: "recent-invoices", label: "Invoices", icon: <IconClock /> },
{ id: "recent-jane", label: "Jane Cooper", icon: <IconClock /> },
],
},
{
heading: "All commands",
items: [
{ id: "customers", label: "Customers", icon: <IconUser /> },
{ id: "files", label: "Files", icon: <IconFolder /> },
{ id: "settings", label: "Settings", icon: <IconSettings /> },
],
},
];
export function CommandRecent() {
return <Command groups={groups} placeholder="Search recent and all commands..." />;
}

Nested

Opens deeper command groups and submenus, with back navigation.

examples/command-nested.tsx
import { IconMoon, IconDeviceDesktop, IconPalette, IconSun } from "@tabler/icons-react";
import { Command, type CommandGroup } from "@/components/wensity/command";
const groups: CommandGroup[] = [
{
items: [
{
id: "theme",
label: "Change theme",
description: "Light, dark, or system",
icon: <IconPalette />,
pageTitle: "Theme",
items: [
{
items: [
{ id: "theme-light", label: "Light", icon: <IconSun /> },
{ id: "theme-dark", label: "Dark", icon: <IconMoon /> },
{ id: "theme-system", label: "System", icon: <IconDeviceDesktop /> },
],
},
],
},
],
},
];
export function CommandNested() {
return <Command groups={groups} placeholder="Search or open a submenu..." />;
}

Dialog

Command palette displayed inside a modal, toggled with ⌘K.

examples/command-dialog.tsx
import { useState } from "react";
import {
IconArrowRight,
IconDeviceDesktop,
IconFileText,
IconFolder,
IconMoon,
IconPalette,
IconPlus,
IconSearch,
IconSettings,
IconSun,
IconUser,
} from "@tabler/icons-react";
import { CommandDialog, type CommandGroup } from "@/components/wensity/command";
const groups: CommandGroup[] = [
{
heading: "Recent",
items: [
{ id: "customer-jane", label: "Jane Cooper", description: "Open customer profile", icon: <IconUser /> },
{ id: "q2-report", label: "Q2 revenue report", description: "Edited 12 minutes ago", icon: <IconFileText /> },
],
},
{
heading: "Navigate",
items: [
{ id: "dashboard", label: "Dashboard", description: "Workspace overview", icon: <IconDeviceDesktop /> },
{ id: "customers", label: "Customers", description: "Accounts, segments, and notes", icon: <IconUser /> },
{ id: "files", label: "Files", description: "Contracts and shared assets", icon: <IconFolder /> },
],
},
{
heading: "Actions",
items: [
{ id: "new-file", label: "Create file", icon: <IconPlus />, shortcut: ["⌘", "N"] },
{ id: "invite", label: "Invite teammate", icon: <IconArrowRight />, shortcut: ["⌘", "I"] },
{ id: "search", label: "Search everywhere", icon: <IconSearch />, shortcut: ["⌘", "K"] },
],
},
{
heading: "Preferences",
items: [
{
id: "theme",
label: "Theme",
description: "Light, dark, or system",
icon: <IconPalette />,
pageTitle: "Theme",
items: [
{
items: [
{ id: "theme-light", label: "Light", icon: <IconSun /> },
{ id: "theme-dark", label: "Dark", icon: <IconMoon /> },
{ id: "theme-system", label: "System", icon: <IconDeviceDesktop /> },
],
},
],
},
{ id: "settings", label: "Workspace settings", icon: <IconSettings />, shortcut: ["⌘", ","] },
],
},
];
export function CommandInDialog() {
const [open, setOpen] = useState(false);
return (
<CommandDialog
open={open}
onOpenChange={setOpen}
groups={groups}
shortcut={{ key: "k", meta: true }}
trigger={
<button
type="button"
className="inline-flex h-9 items-center gap-2 rounded-lg border border-[var(--border)] px-3 text-[13px] text-[var(--muted-foreground)] transition-colors duration-100 ease-out hover:bg-[color-mix(in_srgb,var(--foreground)_4%,var(--background))] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--foreground)_18%,transparent)]"
>
<IconSearch stroke={1.75} className="size-4" />
Search...
</button>
}
/>
);
}