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-commandPreview
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:
pnpm dlx shadcn@4.14.1 add @glassyui/glass-commandWhat this installs11 files, 3 packages
Direct registry declarations
These values belong to @glassyui/glass-command itself in registry.json.
Package dependencies
@radix-ui/react-dialogclsxcmdk
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-dialogclsxcmdk
Installed files
components/glassyui/glass-command.tsxcomponents/glassyui/glass-panel.tsxcomponents/glassyui/glass-surface.tsxcomponents/glassyui/lib/merge-refs.tscomponents/glassyui/lib/refraction-map.tscomponents/glassyui/lib/use-refraction-filter.tsxcomponents/glassyui/lib/scene-context.tscomponents/glassyui/glass-provider.tsxcomponents/glassyui/liquid-filters.tsxcomponents/glassyui/lib/preferences.tscomponents/glassyui/styles/liquid.css
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
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);
}, []);<GlassCommandItem keywords={["dark", "light"]} onSelect={toggleTheme}>
Switch theme
<GlassCommandShortcut>
<GlassKbdGroup><GlassKbd>⌘</GlassKbd><GlassKbd>T</GlassKbd></GlassKbdGroup>
</GlassCommandShortcut>
</GlassCommandItem>API
GlassCommandThe searchable list, on cmdk. filter, shouldFilter, loop and value apply.
GlassCommandDialogA glass dialog near the top of the page that holds a command list. open, onOpenChange and title.
GlassCommandInputThe search field, with a magnifier.
GlassCommandListThe scrolling results. It resizes with them.
GlassCommandGroupA heading and its items. Pass heading.
GlassCommandItemOne command. onSelect runs on Enter or click; keywords widen the search.
GlassCommandEmpty / GlassCommandSeparator / GlassCommandShortcutThe 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.