npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-command-palette.json --yesCommand palette
ProA window of commands under a search field, opened over the app by a key chord such as Cmd K, to run an action by typing its name, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- CommandPaletteTriggerThe button that opens the palette
- CommandPaletteContentThe window (a modal
dialog, name it witharia-label
import { useState } from 'react';
import { CommandGroup, CommandItem, CommandSeparator } from '@/components/ui/goop/command';
import {
CommandPalette,
CommandPaletteContent,
CommandPaletteTrigger,
} from '@/components/ui/goop/command-palette';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
function QuickOpen() {
const [place, setPlace] = useState('Inbox');
return (
<div className="flex items-center gap-2">
<CommandPalette>
<CommandPaletteTrigger asChild>
<IconButton aria-label="Search or run a command">
<IconButtonIcon icon="search" />
</IconButton>
</CommandPaletteTrigger>
<CommandPaletteContent
aria-label="Commands"
searchPlaceholder="Search or run a command..."
hint={['⌘', 'K']}
empty="No command found"
>
<CommandGroup heading="Go to">
{['Inbox', 'Calendar', 'Archive'].map((name) => (
<CommandItem key={name} icon={name === 'Inbox' ? 'inbox' : 'folder'} onSelect={() => setPlace(name)}>
{name}
</CommandItem>
))}
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Create">
<CommandItem icon="file-text">New note</CommandItem>
</CommandGroup>
</CommandPaletteContent>
</CommandPalette>
<span className="text-sm text-muted-foreground">In {place}</span>
</div>
);
}Open the palette from its button or with ⌘K / Ctrl+K from anywhere on the page, type to filter, move with the arrows and run a command with Enter or a click: make a note, go to a place, switch the compact view. What you type is read back under it. Escape or the chord again closes it, the focus back where it was. The places and notes are words in the page; nothing is saved.
When to use
- A window of commands under a search field, opened over the app by a key chord such as Cmd K, to run an action by typing its name.
- Also called: command menu, ⌘K menu or quick switcher.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Command palette on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-command-palette.json --yesAdd the Goop Command palette to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useState } from 'react';
import { CommandGroup, CommandItem, CommandSeparator } from '@/components/ui/goop/command';
import {
CommandPalette,
CommandPaletteContent,
CommandPaletteTrigger,
} from '@/components/ui/goop/command-palette';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
function QuickOpen() {
const [place, setPlace] = useState('Inbox');
return (
<div className="flex items-center gap-2">
<CommandPalette>
<CommandPaletteTrigger asChild>
<IconButton aria-label="Search or run a command">
<IconButtonIcon icon="search" />
</IconButton>
</CommandPaletteTrigger>
<CommandPaletteContent
aria-label="Commands"
searchPlaceholder="Search or run a command..."
hint={['⌘', 'K']}
empty="No command found"
>
<CommandGroup heading="Go to">
{['Inbox', 'Calendar', 'Archive'].map((name) => (
<CommandItem key={name} icon={name === 'Inbox' ? 'inbox' : 'folder'} onSelect={() => setPlace(name)}>
{name}
</CommandItem>
))}
</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Create">
<CommandItem icon="file-text">New note</CommandItem>
</CommandGroup>
</CommandPaletteContent>
</CommandPalette>
<span className="text-sm text-muted-foreground">In {place}</span>
</div>
);
}- Fits: frame: sidebar-search; frame: sidebar-head.
- Also known as: CommandDialog.
- width, padding, gap, corner, background, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| shortcut? | `mod+${string}` | false = 'mod+k' | The chord that opens and closes it, mod+<key> (mod: ⌘ on a Mac, Ctrl elsewhere); false turns it off. |
| open? | boolean | |
| defaultOpen? | boolean = false | |
| onOpenChange? | (open: boolean) => void | |
| modal? | boolean = true |
- Takes every prop of CommandPopover (its page: command.md)
- State: open (open / defaultOpen / onOpenChange)
| Part | What it is |
|---|---|
| CommandPaletteTrigger | The button that opens the palette; wrap your own button in it with asChild, or use it bare; takes asChild |
| CommandPaletteContent | The window (a modal dialog, name it with aria-label; aria-modal while its root is modal), centred over the scrim; searchPlaceholder?: string — The search field's placeholder words, which also name it; hint?: ReactNode | readonly ReactNode[] — The key hint at the field's end: one key's words, or several keys'; searchLabel?: string — The search field's spoken name: its placeholder words when left out, else "Search"; empty?: ReactNode = 'No results' — The words shown while no row matches; null for none; filter?: (value: string, search: string, keywords?: string[]) => number — Scores a row against the typed words, 0 to 1 (0 hides it, the highest first); a fuzzy match when left out; shouldFilter?: boolean — false turns the matching off: the list shows the rows you render (match them on inputValue); inputValue?: string — The search field's typed words, when you hold them; onInputValueChange?: (words: string) => void — Called with the typed words as they change; also takes container?: HTMLElement | null; closeOnSelect?: boolean = true |
- data-slot values (to select a part by): command-content, command-palette-input-shortcut, command-palette-trigger
Keyboard
| Key | What it does |
|---|---|
| ⌘K / Ctrl+K | Open the palette from anywhere on the page, a text field too; again, close it |
| typing | Narrow the rows to those that match, the first of them lit |
| ArrowDown ArrowUp | Move the active row, skipping a disabled one |
| Enter | Run the active row and close the palette |
| Escape | Close the palette; the focus goes back to what had it |
| Tab Shift+Tab | Stay on the search field: the palette is modal and the field its one tab stop |
Accessibility
- The part itself answers the keys above.
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.