command
gmhlab/commandFreeComponent
gmhlab publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/gmhlab/monorepo/main/packages/ui/public/r/command.jsonSource
1"use client"23import * as React from "react"4import { Command as CommandPrimitive } from "cmdk"5import { SearchIcon } from "lucide-react"67import { cn } from "@/lib/utils"8import {9 Dialog,10 DialogContent,11 DialogDescription,12 DialogHeader,13 DialogTitle,14} from "@/components/ui/dialog"1516function Command({17 className,18 ...props19}: React.ComponentProps<typeof CommandPrimitive>) {20 return (21 <CommandPrimitive22 data-slot="command"23 className={cn(24 "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",25 className26 )}27 {...props}28 />29 )30}3132function CommandDialog({33 title = "Command Palette",34 description = "Search for a command to run...",35 children,36 className,37 showCloseButton = true,38 ...props39}: React.ComponentProps<typeof Dialog> & {40 title?: string41 description?: string42 className?: string43 showCloseButton?: boolean44}) {45 return (46 <Dialog {...props}>47 <DialogHeader className="sr-only">48 <DialogTitle>{title}</DialogTitle>49 <DialogDescription>{description}</DialogDescription>50 </DialogHeader>51 <DialogContent52 className={cn("overflow-hidden p-0", className)}53 showCloseButton={showCloseButton}54 >55 <Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[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">56 {children}57 </Command>58 </DialogContent>59 </Dialog>60 )61}6263function CommandInput({64 className,65 ...props66}: React.ComponentProps<typeof CommandPrimitive.Input>) {67 return (68 <div69 data-slot="command-input-wrapper"70 className="flex h-9 items-center gap-2 border-b px-3"71 >72 <SearchIcon className="size-4 shrink-0 opacity-50" />73 <CommandPrimitive.Input74 data-slot="command-input"75 className={cn(76 "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",77 className78 )}79 {...props}80 />81 </div>82 )83}8485function CommandList({86 className,87 ...props88// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from gmhlab
All 64 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | gmhlab | Components | Free | 2 deps | |
| alertalert | gmhlab | Components | Free | 1 dep | |
| alert-dialogalert-dialog | gmhlab | Components | Free | 1 dep | |
| aspect-ratioaspect-ratio | gmhlab | Components | Free | 1 dep | |
| avataravatar | gmhlab | Components | Free | 1 dep | |
| badgebadge | gmhlab | Components | Free | 2 deps | |
| breadcrumbbreadcrumb | gmhlab | Components | Free | 2 deps | |
| buttonbutton | gmhlab | Components | Free | 2 deps |
