GodUIGodUI
109Follow on X

Command Palette

tsx
"use client";import { CommandPalette } from "@/components/godui/command-palette";import { useState } from "react";const groups = [{ heading: "Navigation", items: [  { id: "home", label: "Go to Home", shortcut: "G H", icon: "⌂" },  { id: "docs", label: "Search Docs", shortcut: "G D", icon: "⌕" },] },{ heading: "Actions", items: [  { id: "new", label: "Create New File", shortcut: "⌘N", icon: "+" },  { id: "theme", label: "Toggle Theme", icon: "◐", keywords: ["dark", "light"] },] },];export function CommandPaletteDemo() {const [open, setOpen] = useState(false);return (  <>    <button onClick={() => setOpen(true)} className="rounded-lg border border-border bg-card px-4 py-2 text-sm font-medium text-foreground shadow-sm">Open command palette ⌘K</button>    <CommandPalette open={open} onOpenChange={setOpen} groups={groups} />  </>);}