BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn/command

command

shadcn/command
FreeComponent

shadcn publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by shadcn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add command

Source

ui/command.tsxui.shadcn.com/r/styles/new-york/command.json
1"use client"
2
3import * as React from "react"
4import { type DialogProps } from "@radix-ui/react-dialog"
5import { Command as CommandPrimitive } from "cmdk"
6import { Search } from "lucide-react"
7
8import { cn } from "@/lib/utils"
9import { Dialog, DialogContent } from "@/registry/new-york/ui/dialog"
10
11const Command = React.forwardRef<
12 React.ElementRef<typeof CommandPrimitive>,
13 React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14>(({ className, ...props }, ref) => (
15 <CommandPrimitive
16 ref={ref}
17 className={cn(
18 "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19 className
20 )}
21 {...props}
22 />
23))
24Command.displayName = CommandPrimitive.displayName
25
26const CommandDialog = ({ children, ...props }: DialogProps) => {
27 return (
28 <Dialog {...props}>
29 <DialogContent className="overflow-hidden p-0">
30 <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[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">
31 {children}
32 </Command>
33 </DialogContent>
34 </Dialog>
35 )
36}
37
38const CommandInput = React.forwardRef<
39 React.ElementRef<typeof CommandPrimitive.Input>,
40 React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
41>(({ className, ...props }, ref) => (
42 <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
43 <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
44 <CommandPrimitive.Input
45 ref={ref}
46 className={cn(
47 "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
48 className
49 )}
50 {...props}
51 />
52 </div>
53))
54
55CommandInput.displayName = CommandPrimitive.Input.displayName
56
57const CommandList = React.forwardRef<
58 React.ElementRef<typeof CommandPrimitive.List>,
59 React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
60>(({ className, ...props }, ref) => (
61 <CommandPrimitive.List
62 ref={ref}
63 className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
64 {...props}
65 />
66))
67
68CommandList.displayName = CommandPrimitive.List.displayName
69
70const CommandEmpty = React.forwardRef<
71// … truncated

What it pulls in

npm packages

  • cmdk

Other registry items

  • dialog
  • input-group

Files it writes

  • ui/command.tsx

Facts

Registry
shadcn
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on shadcn ui.shadcn.com shadcn-ui/ui on GitHub Raw registry item This item as JSON

More from shadcn

All 62 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionshadcnComponentsFreeno deps
alertalertshadcnComponentsFreeno deps
alert-dialogalert-dialogshadcnComponentsFreeno deps
aspect-ratioaspect-ratioshadcnComponentsFreeno deps
attachmentattachmentshadcnComponentsFreeno deps
avataravatarshadcnComponentsFreeno deps
badgebadgeshadcnComponentsFreeno deps
breadcrumbbreadcrumbshadcnComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex