{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "command",
  "type": "registry:ui",
  "title": "Command",
  "description": "A command palette: a search field over a filtered, keyboard-driven list of actions, inline or in a dialog.",
  "categories": [
    "ui"
  ],
  "dependencies": [
    "cmdk",
    "lucide-react"
  ],
  "registryDependencies": [
    "@rivier-ui/theme",
    "@rivier-ui/cn",
    "@rivier-ui/dialog"
  ],
  "files": [
    {
      "path": "registry/ui/command.tsx",
      "type": "registry:ui",
      "target": "components/ui/command.tsx",
      "content": "\"use client\";\n/**\n * @name command\n * @category ui\n * @description A command palette: a search field over a filtered, keyboard-driven list of actions, inline or in a dialog.\n * @when Fast access to many actions or pages by typing (the Ctrl/Cmd+K palette), or a searchable list inside a popover. For a handful of actions use dropdown-menu. CommandDialog is usually opened by a shortcut, with no trigger, so focus has nowhere to return: remember the opener (`opener.current = document.activeElement` before opening) and refocus it in `onCloseAutoFocus={(event) => { event.preventDefault(); opener.current?.focus(); }}`.\n * @example\n * const [open, setOpen] = useState(false);\n *\n * <Button variant=\"outline\" onClick={() => setOpen(true)}>Search</Button>\n * <CommandDialog open={open} onOpenChange={setOpen}>\n *   <CommandInput placeholder=\"Type a command\" />\n *   <CommandList>\n *     <CommandEmpty>Nothing found.</CommandEmpty>\n *     <CommandGroup heading=\"Pages\">\n *       <CommandItem onSelect={() => setOpen(false)}>Dashboard</CommandItem>\n *       <CommandItem onSelect={() => setOpen(false)}>Settings <CommandShortcut>Ctrl ,</CommandShortcut></CommandItem>\n *     </CommandGroup>\n *     <CommandSeparator />\n *     <CommandGroup heading=\"Account\">\n *       <CommandItem onSelect={() => setOpen(false)}>Sign out</CommandItem>\n *     </CommandGroup>\n *   </CommandList>\n * </CommandDialog>\n */\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\nimport type { ComponentProps } from \"react\";\nimport { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, type DialogContentProps } from \"@/components/ui/dialog\";\nimport { cn } from \"@/lib/cn\";\n\n/** The palette itself. Use it inline (in a card or popover), or let CommandDialog wrap it. */\nexport function Command({ className, ...props }: ComponentProps<typeof CommandPrimitive>) {\n  return (\n    <CommandPrimitive\n      data-slot=\"command\"\n      className={cn(\"flex min-h-0 w-full flex-col overflow-hidden rounded-surface bg-popover text-popover-foreground\", className)}\n      {...props}\n    />\n  );\n}\n\nexport type CommandDialogProps = ComponentProps<typeof Dialog> &\n  Pick<DialogContentProps, \"onCloseAutoFocus\" | \"onOpenAutoFocus\"> & {\n    /** The dialog's accessible name. Read by screen readers, not shown. */\n    title?: string;\n    /** The dialog's accessible description. Read by screen readers, not shown. */\n    description?: string;\n    /** Classes for the dialog window. */\n    className?: string;\n    /** Props for the palette inside: `filter`, `shouldFilter`, `loop`, `label`. */\n    commandProps?: ComponentProps<typeof CommandPrimitive>;\n  };\n\n/** The palette in a dialog. Escape and a click outside close it, so it has no close button. */\nexport function CommandDialog({\n  title = \"Command palette\",\n  description = \"Type to search, use the arrow keys to move, Enter to run.\",\n  className,\n  commandProps,\n  onCloseAutoFocus,\n  onOpenAutoFocus,\n  children,\n  ...props\n}: CommandDialogProps) {\n  return (\n    <Dialog {...props}>\n      <DialogContent\n        showCloseButton={false}\n        onCloseAutoFocus={onCloseAutoFocus}\n        onOpenAutoFocus={onOpenAutoFocus}\n        className={cn(\"gap-0 overflow-hidden bg-popover p-0 text-popover-foreground\", className)}\n      >\n        <DialogHeader className=\"sr-only\">\n          <DialogTitle>{title}</DialogTitle>\n          <DialogDescription>{description}</DialogDescription>\n        </DialogHeader>\n        <Command {...commandProps}>{children}</Command>\n      </DialogContent>\n    </Dialog>\n  );\n}\n\n/** The search field. The focus ring is drawn on the whole row, inside its edge. */\nexport function CommandInput({ className, ...props }: ComponentProps<typeof CommandPrimitive.Input>) {\n  return (\n    <div\n      data-slot=\"command-input-wrapper\"\n      className=\"flex h-12 shrink-0 items-center gap-2 border-b px-3.5 has-focus-visible:outline-2 has-focus-visible:-outline-offset-2 has-focus-visible:outline-ring\"\n    >\n      <Search aria-hidden=\"true\" strokeWidth={1.5} className=\"size-4 shrink-0 text-muted-foreground\" />\n      <CommandPrimitive.Input\n        data-slot=\"command-input\"\n        className={cn(\n          \"h-full min-w-0 flex-1 bg-transparent text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n          className,\n        )}\n        {...props}\n      />\n    </div>\n  );\n}\n\nexport function CommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>) {\n  return (\n    <CommandPrimitive.List\n      data-slot=\"command-list\"\n      className={cn(\"max-h-80 min-h-0 scroll-py-1 overflow-x-hidden overflow-y-auto p-1\", className)}\n      {...props}\n    />\n  );\n}\n\nexport function CommandEmpty({ className, ...props }: ComponentProps<typeof CommandPrimitive.Empty>) {\n  return <CommandPrimitive.Empty data-slot=\"command-empty\" className={cn(\"px-2.5 py-6 text-center text-sm text-muted-foreground\", className)} {...props} />;\n}\n\nexport function CommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>) {\n  return (\n    <CommandPrimitive.Group\n      data-slot=\"command-group\"\n      className={cn(\n        \"overflow-hidden text-foreground [&_[cmdk-group-heading]]:px-2.5 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\nexport function CommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>) {\n  return <CommandPrimitive.Separator data-slot=\"command-separator\" className={cn(\"-mx-1 my-1 h-px bg-border\", className)} {...props} />;\n}\n\n/** One action. Focus stays in the search field; the active item is marked by cmdk's `data-selected`. */\nexport function CommandItem({ className, ...props }: ComponentProps<typeof CommandPrimitive.Item>) {\n  return (\n    <CommandPrimitive.Item\n      data-slot=\"command-item\"\n      className={cn(\n        \"relative flex min-h-9 cursor-default items-center gap-2 rounded-control px-2.5 py-1.5 text-sm select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground pointer-coarse:min-h-10 [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\n/** A keyboard hint at the end of an item. It only shows the keys: bind them yourself. */\nexport function CommandShortcut({ className, ...props }: ComponentProps<\"span\">) {\n  return <span data-slot=\"command-shortcut\" className={cn(\"ms-auto ps-4 text-xs tracking-widest text-muted-foreground\", className)} {...props} />;\n}\n"
    }
  ],
  "meta": {
    "category": "ui",
    "when": "Fast access to many actions or pages by typing (the Ctrl/Cmd+K palette), or a searchable list inside a popover. For a handful of actions use dropdown-menu. CommandDialog is usually opened by a shortcut, with no trigger, so focus has nowhere to return: remember the opener (`opener.current = document.activeElement` before opening) and refocus it in `onCloseAutoFocus={(event) => { event.preventDefault(); opener.current?.focus(); }}`.",
    "example": "const [open, setOpen] = useState(false);\n\n<Button variant=\"outline\" onClick={() => setOpen(true)}>Search</Button>\n<CommandDialog open={open} onOpenChange={setOpen}>\n  <CommandInput placeholder=\"Type a command\" />\n  <CommandList>\n    <CommandEmpty>Nothing found.</CommandEmpty>\n    <CommandGroup heading=\"Pages\">\n      <CommandItem onSelect={() => setOpen(false)}>Dashboard</CommandItem>\n      <CommandItem onSelect={() => setOpen(false)}>Settings <CommandShortcut>Ctrl ,</CommandShortcut></CommandItem>\n    </CommandGroup>\n    <CommandSeparator />\n    <CommandGroup heading=\"Account\">\n      <CommandItem onSelect={() => setOpen(false)}>Sign out</CommandItem>\n    </CommandGroup>\n  </CommandList>\n</CommandDialog>",
    "client": true
  }
}
