{
  "name": "command-stack-dialog-demo",
  "type": "registry:example",
  "registryDependencies": [
    "button",
    "command",
    "command-stack"
  ],
  "files": [
    {
      "path": "examples/command-stack-dialog-demo.tsx",
      "type": "registry:example",
      "content": "\"use client\";\n\nimport {\n  CircleDot,\n  FolderKanban,\n  LayoutDashboard,\n  Monitor,\n  Moon,\n  Palette,\n  Plus,\n  Settings,\n  Sun,\n} from \"lucide-react\";\nimport * as React from \"react\";\n\nimport { Button } from \"@/registry/bases/radix/ui/button\";\nimport { CommandDialog } from \"@/registry/bases/radix/ui/command\";\nimport {\n  CommandStack,\n  CommandStackEmpty,\n  CommandStackGroup,\n  CommandStackInput,\n  CommandStackItem,\n  CommandStackList,\n  CommandStackPage,\n  CommandStackShortcut,\n} from \"@/registry/bases/radix/ui/command-stack\";\n\nconst projects = [\"Marketing Website\", \"Mobile App\", \"Design System\"];\n\nexport default function CommandStackDialogDemo() {\n  const [open, setOpen] = React.useState(false);\n\n  React.useEffect(() => {\n    function onKeyDown(event: KeyboardEvent) {\n      if (event.key === \"j\" && (event.metaKey || event.ctrlKey)) {\n        event.preventDefault();\n        setOpen((prevOpen) => !prevOpen);\n      }\n    }\n\n    document.addEventListener(\"keydown\", onKeyDown);\n    return () => document.removeEventListener(\"keydown\", onKeyDown);\n  }, []);\n\n  function onRun() {\n    setOpen(false);\n  }\n\n  return (\n    <>\n      <Button variant=\"outline\" onClick={() => setOpen(true)}>\n        Search...\n        <kbd className=\"pointer-events-none rounded-sm border bg-muted px-1.5 font-mono text-[10px] text-muted-foreground\">\n          ⌘J\n        </kbd>\n      </Button>\n      <CommandDialog open={open} onOpenChange={setOpen}>\n        <CommandStack>\n          <CommandStackInput\n            variant=\"line\"\n            placeholder=\"Type a command or search...\"\n          />\n          <CommandStackList>\n            <CommandStackEmpty>No results found.</CommandStackEmpty>\n            <CommandStackPage value=\"root\" label=\"Home\">\n              <CommandStackGroup heading=\"Navigation\">\n                <CommandStackItem onSelect={onRun}>\n                  <LayoutDashboard />\n                  Dashboard\n                  <CommandStackShortcut>G D</CommandStackShortcut>\n                </CommandStackItem>\n                <CommandStackItem page=\"projects\">\n                  <FolderKanban />\n                  Go to project...\n                  <CommandStackShortcut>G P</CommandStackShortcut>\n                </CommandStackItem>\n                <CommandStackItem onSelect={onRun}>\n                  <Settings />\n                  Settings\n                  <CommandStackShortcut>G S</CommandStackShortcut>\n                </CommandStackItem>\n              </CommandStackGroup>\n              <CommandStackGroup heading=\"Actions\">\n                <CommandStackItem onSelect={onRun}>\n                  <CircleDot />\n                  Create issue\n                  <CommandStackShortcut>C</CommandStackShortcut>\n                </CommandStackItem>\n                <CommandStackItem onSelect={onRun}>\n                  <Plus />\n                  Create project\n                </CommandStackItem>\n                <CommandStackItem page=\"theme\">\n                  <Palette />\n                  Change theme...\n                </CommandStackItem>\n              </CommandStackGroup>\n            </CommandStackPage>\n            <CommandStackPage\n              value=\"projects\"\n              label=\"Projects\"\n              placeholder=\"Search projects...\"\n            >\n              {projects.map((project) => (\n                <CommandStackItem key={project} onSelect={onRun}>\n                  <FolderKanban />\n                  {project}\n                </CommandStackItem>\n              ))}\n            </CommandStackPage>\n            <CommandStackPage\n              value=\"theme\"\n              label=\"Theme\"\n              placeholder=\"Change theme...\"\n            >\n              <CommandStackItem onSelect={onRun}>\n                <Sun />\n                Light\n              </CommandStackItem>\n              <CommandStackItem onSelect={onRun}>\n                <Moon />\n                Dark\n              </CommandStackItem>\n              <CommandStackItem onSelect={onRun}>\n                <Monitor />\n                System\n              </CommandStackItem>\n            </CommandStackPage>\n          </CommandStackList>\n        </CommandStack>\n      </CommandDialog>\n    </>\n  );\n}\n",
      "target": ""
    }
  ]
}