npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-command-palette.json --yesCommand palette
ProA layer 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 panel (a modal
dialog, name it witharia-label
import { CommandPalette, CommandPaletteTrigger, CommandPaletteContent } from '@/components/ui/goop/command-palette';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { CommandGroup, CommandItem } from '@/components/ui/goop/command';
<CommandPalette>
<CommandPaletteTrigger asChild>
<IconButton variant="ghost" aria-label="Search everything">
<IconButtonIcon icon="search" />
</IconButton>
</CommandPaletteTrigger>
<CommandPaletteContent aria-label="Search everything" searchPlaceholder="Search or run a command" empty="No results">
<CommandGroup heading="Go to">
<CommandItem onSelect={openSettings}>Settings</CommandItem>
<CommandItem>Inbox</CommandItem>
</CommandGroup>
</CommandPaletteContent>
</CommandPalette>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 layer 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>/trail-command-palette.json --yesAdd the Goop Command palette to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { CommandPalette, CommandPaletteTrigger, CommandPaletteContent } from '@/components/ui/goop/command-palette';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { CommandGroup, CommandItem } from '@/components/ui/goop/command';
<CommandPalette>
<CommandPaletteTrigger asChild>
<IconButton variant="ghost" aria-label="Search everything">
<IconButtonIcon icon="search" />
</IconButton>
</CommandPaletteTrigger>
<CommandPaletteContent aria-label="Search everything" searchPlaceholder="Search or run a command" empty="No results">
<CommandGroup heading="Go to">
<CommandItem onSelect={openSettings}>Settings</CommandItem>
<CommandItem>Inbox</CommandItem>
</CommandGroup>
</CommandPaletteContent>
</CommandPalette>- Fits: frame: sidebar-search; frame: sidebar-head.
- Also known as: CommandDialog.
- height, width, padding, gap, border, background, text, motion: 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); drawn by data-focus-visible, data-disabled
| 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 panel (a modal dialog, name it with aria-label; aria-modal while its root is modal); 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-palette-input-group, command-palette-input-row, command-palette-input-shortcut, command-palette-trigger
Accessibility
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| focus-visible | the attribute data-focus-visible |
| disabled | the attribute data-disabled |
Motion
- The part sets its own motion: add no transition or animation of your own.
- How the theme moves, and how to move your own parts the same way: Motion.
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.