Command Palette
Command Palette filters supplied items and exposes a keyboard shortcut and open state.
Practical React example
Find and run an existing workspace command by its label or keywords.
Before you copy and paste
Keep the example in the React rendering environment required by the imported component. Copy components/motion/command-palette.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: clsx, lucide-react, motion, react, react-dom, tailwind-merge.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Find and run an existing workspace command by its label or keywords
// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";
import { FileText, Home, Plus, Settings, User } from "lucide-react";
import { useState } from "react";
import { CommandPalette } from "@/components/motion/command-palette";
export function CommandPalettePreview() {
const [open, setOpen] = useState(false);
return (
<div className="flex flex-col items-start gap-3">
<button
type="button"
onClick={() => setOpen(true)}
className="inline-flex h-10 items-center rounded-full border border-border bg-card px-5 text-sm font-medium text-foreground press hover:border-(--color-border-strong)"
>
Open command palette
</button>
<p className="text-sm text-muted-foreground">
Press{" "}
<kbd className="rounded border border-border bg-card px-1.5 py-0.5 text-xs text-foreground">
⌘ J
</kbd>{" "}
(or <kbd className="rounded border border-border bg-card px-1.5 py-0.5 text-xs text-foreground">Ctrl J</kbd>) to open.
</p>
<CommandPalette
open={open}
onOpenChange={setOpen}
shortcut="j"
items={[
{ id: "home", label: "Go to Home", group: "Navigation", icon: Home, hint: "G H", onSelect: () => {} },
{ id: "profile", label: "Open profile", group: "Navigation", icon: User, hint: "G P", onSelect: () => {} },
{ id: "settings", label: "Settings", group: "Navigation", icon: Settings, onSelect: () => {} },
{ id: "new-doc", label: "Create document", group: "Actions", icon: FileText, hint: "⌘ N", onSelect: () => {} },
{ id: "new-project", label: "New project", group: "Actions", icon: Plus, hint: "⌘ ⇧ N", onSelect: () => {} },
]}
/>
</div>
);
}
Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.
Map each item’s onSelect to a real application command. Keep the command’s enabled state and authorization aligned with the current record.
Customization
- CommandPaletteProps.items
- Required; CommandItem[].
- CommandPaletteProps.shortcut
- Optional; string. Opens with Cmd/Ctrl + this key. Default: "k"
- CommandPaletteProps.placeholder
- Optional; string.
- CommandPaletteProps.emptyMessage
- Optional; string.
- CommandPaletteProps.open
- Optional; boolean.
- CommandPaletteProps.onOpenChange
- Optional; (open: boolean) => void.
- PresenceGateRenderProps.isPresent
- Required; boolean. False from the render that starts the exit animation onward. An overlay kept in the tree by `AnimatePresence` is still the topmost thing on the page, so anything it decides from `open` alone stays true for the whole exit — this is the boolean that already knows the overlay is leaving.
- PresenceGateRenderProps.gate
- Required; { inert: boolean; style: { pointerEvents: "auto" | "none" }; }. Spread onto every layer that takes pointer events while the overlay is open. Interaction releases in the same commit that starts the exit while the visual exit keeps playing: pointer events stop landing, and `inert` drops the subtree from focus order, from tab order and from the accessibility tree — an exiting dialog is not a dialog you can still type into. A layer that never takes pointer events (a wrapper that only centres the panel) takes `inert={!isPresent}` alone, so its own `pointer-events-none` is not overwritten.
- PresenceGateProps.children
- Required; (props: PresenceGateRenderProps) => ReactNode.
Integration notes
- The palette is a discovery surface, not a command authorization boundary.
- Avoid taking over a shortcut already used by an essential browser or application action.
Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.