MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / CommandDialog

Function CommandDialog

packages/react/src/components/command.tsx:23–58  ·  view source on GitHub ↗
({
  title = "Command Palette",
  description = "Search for a command to run...",
  children,
  className,
  showCloseButton = true,
  dismissOnOutsideClick = true,
  ...props
}: React.ComponentProps<typeof Dialog> & {
  title?: string;
  description?: string;
  className?: string;
  showCloseButton?: boolean;
  /** A command palette holds nothing but a search string, and clicking away is
   *  the expected way to leave it, so this stays on — unlike `DialogContent`,
   *  whose default protects form state. */
  dismissOnOutsideClick?: boolean;
})

Source from the content-addressed store, hash-verified

21}
22
23function CommandDialog({
24 title = "Command Palette",
25 description = "Search for a command to run...",
26 children,
27 className,
28 showCloseButton = true,
29 dismissOnOutsideClick = true,
30 ...props
31}: React.ComponentProps<typeof Dialog> & {
32 title?: string;
33 description?: string;
34 className?: string;
35 showCloseButton?: boolean;
36 /** A command palette holds nothing but a search string, and clicking away is
37 * the expected way to leave it, so this stays on — unlike `DialogContent`,
38 * whose default protects form state. */
39 dismissOnOutsideClick?: boolean;
40}) {
41 return (
42 <Dialog {...props}>
43 <DialogHeader className="sr-only">
44 <DialogTitle>{title}</DialogTitle>
45 <DialogDescription>{description}</DialogDescription>
46 </DialogHeader>
47 <DialogContent
48 className={cn("overflow-hidden p-0", className)}
49 showCloseButton={showCloseButton}
50 dismissOnOutsideClick={dismissOnOutsideClick}
51 >
52 <Command className="**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
53 {children}
54 </Command>
55 </DialogContent>
56 </Dialog>
57 );
58}
59
60function CommandInput({
61 className,

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected