Browse docsCommand

OverlaysNew

Glass Command

A searchable command list that filters as you type, alone or in a launcher dialog.

pnpm dlx shadcn@4.14.1 add @glassyui/glass-command

Preview

Demos ready. Update 0.

Installation

First add the exact @glassyui mapping to components.json as shown in Getting Started. Then run the pinned item command:

Install Glass Command

pnpm dlx shadcn@4.14.1 add @glassyui/glass-command
What this installs11 files, 3 packages

Direct registry declarations

These values belong to @glassyui/glass-command itself in registry.json.

Package dependencies

  • @radix-ui/react-dialog
  • clsx
  • cmdk

Registry dependencies

  • @glassyui/glass-panel

File targets

  • components/glassyui/glass-command.tsx

Complete installed closure

This follows every namespaced registry dependency recursively and de-duplicates the packages and target files installed with this item.

Package dependencies

  • @radix-ui/react-dialog
  • clsx
  • cmdk

Installed files

  • components/glassyui/glass-command.tsx
  • components/glassyui/glass-panel.tsx
  • components/glassyui/glass-surface.tsx
  • components/glassyui/lib/merge-refs.ts
  • components/glassyui/lib/refraction-map.ts
  • components/glassyui/lib/use-refraction-filter.tsx
  • components/glassyui/lib/scene-context.ts
  • components/glassyui/glass-provider.tsx
  • components/glassyui/liquid-filters.tsx
  • components/glassyui/lib/preferences.ts
  • components/glassyui/styles/liquid.css

Usage

Usage

import {
  GlassCommand,
  GlassCommandDialog,
  GlassCommandEmpty,
  GlassCommandGroup,
  GlassCommandInput,
  GlassCommandItem,
  GlassCommandList,
} from "@/components/glassyui/glass-command";

export function Launcher({ open, onOpenChange }: { open: boolean; onOpenChange: (open: boolean) => void }) {
  return (
    <GlassCommandDialog open={open} onOpenChange={onOpenChange}>
      <GlassCommand label="Commands">
        <GlassCommandInput placeholder="Type a command or search…" />
        <GlassCommandList>
          <GlassCommandEmpty>No results found.</GlassCommandEmpty>
          <GlassCommandGroup heading="Suggestions">
            <GlassCommandItem onSelect={() => onOpenChange(false)}>New file</GlassCommandItem>
          </GlassCommandGroup>
        </GlassCommandList>
      </GlassCommand>
    </GlassCommandDialog>
  );
}

Examples

Open with ⌘K

useEffect(() => {
  const onKeyDown = (event: KeyboardEvent) => {
    if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
      event.preventDefault();
      setOpen((current) => !current);
    }
  };

  document.addEventListener("keydown", onKeyDown);

  return () => document.removeEventListener("keydown", onKeyDown);
}, []);
Shortcuts and keywords

<GlassCommandItem keywords={["dark", "light"]} onSelect={toggleTheme}>
  Switch theme
  <GlassCommandShortcut>
    <GlassKbdGroup><GlassKbd>⌘</GlassKbd><GlassKbd>T</GlassKbd></GlassKbdGroup>
  </GlassCommandShortcut>
</GlassCommandItem>

API

GlassCommand

The searchable list, on cmdk. filter, shouldFilter, loop and value apply.

GlassCommandDialog

A glass dialog near the top of the page that holds a command list. open, onOpenChange and title.

GlassCommandInput

The search field, with a magnifier.

GlassCommandList

The scrolling results. It resizes with them.

GlassCommandGroup

A heading and its items. Pass heading.

GlassCommandItem

One command. onSelect runs on Enter or click; keywords widen the search.

GlassCommandEmpty / GlassCommandSeparator / GlassCommandShortcut

The no-results message, a divider, and a right-aligned shortcut hint.

Notes

Keyboard

Arrow keys move the highlight, Enter runs the item and Escape closes the dialog. Focus stays in the search field, and returns to whatever opened the dialog when it closes.

Composition

GlassCommand is a bare list. Put it in a GlassPanel, a GlassPopover or GlassCommandDialog.

On this site

The search in the header is a GlassCommandDialog. Press ⌘K (Ctrl K elsewhere) to open it.

Accessibility

Keep the Radix-backed semantics intact and preserve visible labels, focus states, and keyboard operation when copying the source.

Performance

Use provider quality preferences for dense app screens. Reserve strong refraction for hero or showcase surfaces.