command
9ui/commandFreeComponent
9ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by 9ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://9ui.dev/r/command.jsonSource
1"use client"23import * as React from "react"4import { Command as CommandBase } from "cmdk-base"5import { SearchIcon } from "lucide-react"67import {8 Dialog,9 DialogContent,10 DialogDescription,11 DialogHeader,12 DialogTitle,13} from "@/components/ui/dialog"1415import { cn } from "@/lib/utils"1617function Command({18 className,19 ...props20}: React.ComponentProps<typeof CommandBase>) {21 return (22 <CommandBase23 data-slot="command"24 className={cn(25 "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md border outline-none",26 className27 )}28 {...props}29 />30 )31}3233function CommandDialog({34 title = "Command Palette",35 description = "Search for a command to run...",36 className,37 showCloseButton = false,38 children,39 ...props40}: React.ComponentProps<typeof Dialog> & {41 title?: string42 description?: string43 className?: string44 showCloseButton?: boolean45 children?: React.ReactNode46}) {47 return (48 <Dialog {...props}>49 <DialogHeader className="sr-only">50 <DialogTitle>{title}</DialogTitle>51 <DialogDescription>{description}</DialogDescription>52 </DialogHeader>53 <DialogContent54 className={cn("overflow-hidden p-0", className)}55 showCloseButton={showCloseButton}56 >57 <Command>{children}</Command>58 </DialogContent>59 </Dialog>60 )61}6263function CommandInput({64 className,65 disabled,66 ...props67}: React.ComponentProps<typeof CommandBase.Input>) {68 return (69 <div70 data-slot="command-input-wrapper"71 className="flex h-9 items-center gap-2 border-b px-3"72 >73 <SearchIcon className="size-4 shrink-0 opacity-50" />74 <CommandBase.Input75 data-slot="command-input"76 className={cn(77 "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden data-disabled:pointer-events-none data-disabled:opacity-50",78 className79 )}80 data-disabled={disabled}81 disabled={disabled}82 {...props}83 />84 </div>85 )86}8788function CommandList({89 className,90 ...props91}: React.ComponentProps<typeof CommandBase.List>) {92 return (93 <CommandBase.List94 data-slot="command-list"95 className={cn(96 "max-h-[300px] overflow-x-hidden overflow-y-auto outline-hidden",97 className98 )}99 {...props}100 />101 )102}103104function CommandEmpty({105 ...props106}: React.ComponentProps<typeof CommandBase.Empty>) {107 return (108 <CommandBase.Empty109 data-slot="command-empty"110 className="py-6 text-center text-sm"111 {...props}112 />113 )114}115116function CommandGroup({117 className,118 ...props119// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from 9ui
All 56 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | 9ui | Components | Free | no deps | |
| alertalert | 9ui | Components | Free | no deps | |
| alert-dialogalert-dialog | 9ui | Components | Free | no deps | |
| aspect-ratioaspect-ratio | 9ui | Components | Free | no deps | |
| autocompleteautocomplete | 9ui | Components | Free | no deps | |
| avataravatar | 9ui | Components | Free | no deps | |
| badgebadge | 9ui | Components | Free | no deps | |
| breadcrumbsbreadcrumbs | 9ui | Components | Free | no deps |
