Glin UI
Primitive / Moleculebeta

Command

Command palette for keyboard-driven actions and search.

Edit on GitHub
UpDown to moveEnter to open

Installation

Install from
pnpm dlx @glinui/cli@latest add command

Prefer the package?

Usage

Assign to

The same component as a people picker, pre-filtered by the typed letter.

"use client"
import {
Avatar,
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandShortcut
} from "@glinui/ui"
export function CommandUsersExample() {
const people = [
{ name: "Ava Kim", role: "Owner", initials: "AK" },
{ name: "Jon Reyes", role: "Admin", initials: "JR" },
{ name: "Sara Patel", role: "Editor", initials: "SP" },
{ name: "Mia Chen", role: "Viewer", initials: "MC" }
]
return (
<div className="mx-auto w-full max-w-sm">
<Command className="rounded-2xl border border-[var(--line-soft)]">
<CommandInput placeholder="Assign to..." defaultValue="a" />
<CommandList>
<CommandEmpty>Nobody matches that name.</CommandEmpty>
<CommandGroup heading="People">
{people.map((person) => (
<CommandItem key={person.name} value={person.name}>
<Avatar size="xs" fallback={person.initials} alt="" />
{person.name}
<CommandShortcut>{person.role}</CommandShortcut>
</CommandItem>
))}
</CommandGroup>
</CommandList>
</Command>
</div>
)
}

Variants

Every look of the shared vocabulary: glinr (the default), plain (shadcn), solid, soft, outline, ghost, gradient and glass. Omit `variant` to follow the ambient design style.

import { Command, CommandGroup, CommandInput, CommandItem, CommandList } from "@glinui/ui"
const variants = ["glinr", "plain", "solid", "soft", "outline", "ghost", "gradient", "glass"] as const
export function Demo() {
return (
<div className="grid gap-3 md:grid-cols-2">
{variants.map((variant) => (
<Command key={variant} variant={variant} size="sm">
<CommandInput placeholder={`${variant} palette`} />
<CommandList>
<CommandGroup heading="Actions">
<CommandItem>Open settings</CommandItem>
<CommandItem>Invite teammate</CommandItem>
</CommandGroup>
</CommandList>
</Command>
))}
</div>
)
}

Glass (opt-in)

variant="glass" is opt-in. It blurs and tints what sits behind the panel (with a readable opacity floor), so it needs a colourful or photographic backdrop: switch the stage backdrop to see it.

import { Command, CommandGroup, CommandInput, CommandItem, CommandList } from "@glinui/ui"
export function Demo() {
return (
<Command variant="glass" className="max-w-md">
<CommandInput placeholder="Search..." />
<CommandList>
<CommandGroup heading="Actions">
<CommandItem>Open settings</CommandItem>
<CommandItem>Invite teammate</CommandItem>
</CommandGroup>
</CommandList>
</Command>
)
}

With Groups

Use `CommandGroup` with a `heading` to visually separate related actions. Add `CommandSeparator` between groups.

import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandSeparator } from "@glinui/ui"

export function CommandGroupsDemo() {
  return (
    <Command className="max-w-md">
      <CommandInput aria-label="Command search" placeholder="Search..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandGroup heading="Files">
          <CommandItem>Open file</CommandItem>
          <CommandItem>New file</CommandItem>
        </CommandGroup>
        <CommandSeparator />
        <CommandGroup heading="Workspace">
          <CommandItem>Settings</CommandItem>
          <CommandItem>Extensions</CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

With Shortcuts

Append `CommandShortcut` inside any `CommandItem` to display a keyboard shortcut hint.

import { Command, CommandInput, CommandList, CommandGroup, CommandItem, CommandShortcut } from "@glinui/ui"

export function CommandShortcutsDemo() {
  return (
    <Command className="max-w-md">
      <CommandInput aria-label="Command search" placeholder="Search..." />
      <CommandList>
        <CommandGroup heading="Navigation">
          <CommandItem>
            Profile
            <CommandShortcut>⌘P</CommandShortcut>
          </CommandItem>
          <CommandItem>
            New Window
            <CommandShortcut>⌘N</CommandShortcut>
          </CommandItem>
          <CommandItem>
            Settings
            <CommandShortcut>⌘,</CommandShortcut>
          </CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

Empty State

`CommandEmpty` renders when the search query returns no matching items.

import { Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from "@glinui/ui"

export function CommandEmptyDemo() {
  return (
    <Command className="max-w-md">
      <CommandInput aria-label="Command search" placeholder="Search for something rare..." />
      <CommandList>
        <CommandEmpty>No results found.</CommandEmpty>
        <CommandGroup heading="Items">
          <CommandItem>Visible item</CommandItem>
        </CommandGroup>
      </CommandList>
    </Command>
  )
}

Accessibility

  • Built on cmdk with keyboard-first navigation.
  • Input auto-focuses for immediate search.
  • Keyboard navigation and roving focus are provided by `cmdk`.
  • Do not rely on placeholder text as a label. Provide an explicit `aria-label` or visible label for `CommandInput`.
  • Keep command groups concise to reduce cognitive load.
  • `CommandEmpty` provides a visible fallback for screen readers.

Keyboard Interactions

KeyAction
Arrow Up / DownNavigate between items.
EnterSelect the highlighted item.
EscapeClose the command palette.

ARIA Attributes

  • `role="listbox"` on list
  • `role="option"` on items
  • `aria-selected`

Reduced Motion

List transitions respect `prefers-reduced-motion`.

Command interactions are state-based with no transform-heavy animations. Motion respects `prefers-reduced-motion` automatically.

Affected properties

opacitytransform

API Reference

Command

PropTypeRequiredDefaultDescription
childrenReactNode--CommandInput, CommandList, etc.
variantPanelVariantPropNodefaultSurface style for the command root.
size"sm" | "md" | "lg"NomdDensity scale for input and item rows.
classNamestring--Additional class names.
filter(value: string, search: string) => number--Custom filter function.
shouldFilterboolean-trueEnable built-in filtering.

CommandInput

PropTypeRequiredDefaultDescription
placeholderstring--Placeholder text for the search input.
classNamestring--Additional class names.
size"sm" | "md" | "lg"No"md"Variant option from commandVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop to read as frosted.

CommandList

PropTypeRequiredDefaultDescription
classNamestring--Additional class names.
size"sm" | "md" | "lg"No"md"Variant option from commandVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop to read as frosted.

CommandGroup

PropTypeRequiredDefaultDescription
headingstring--Group heading label.
classNamestring--Additional class names.
size"sm" | "md" | "lg"No"md"Variant option from commandVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop to read as frosted.

CommandItem

PropTypeRequiredDefaultDescription
valuestring--Value used for filtering and selection.
onSelect(value: string) => void--Called when item is selected.
disabledboolean-falsePrevents interaction.
size"sm" | "md" | "lg"No"md"Variant option from commandVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop to read as frosted.

CommandShortcut

PropTypeRequiredDefaultDescription
classNamestring--Additional class names.
size"sm" | "md" | "lg"No"md"Variant option from commandVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop to read as frosted.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { Command } from "@glinui/ui"

Source Files

Dependencies

@glinui/uicmdk

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/command.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

CommandProps

CommandProps

PropTypeRequiredDefaultDescription
size"sm" | "md" | "lg"No"md"Variant option from commandVariants.
variantPanelVariantPropNo-Surface look. Omit for the ambient design style (glinr by default). `glass` is opt-in and needs a rich backdrop to read as frosted.