BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/optics/command

Command

optics/command
FreeComponent

Fast, composable, unstyled command menu for React.

See it running

Open the demo on optics

optics.agusmayol.com.ar/components/command
Open
This registry sends X-Frame-Options, so its page cannot be embedded here. The link is the same page the frame would have shown.

Install it

npx shadcn@latest add https://optics.agusmayol.com.ar/r/command.json

Source

registry/optics/command.jsxoptics.agusmayol.com.ar/r/command.json
1"use client";
2
3import * as React from "react";
4import { Command as CommandPrimitive } from "cmdk";
5
6import { cn } from "@/lib/utils";
7import {
8 Dialog,
9 DialogPopup,
10 DialogDescription,
11 DialogHeader,
12 DialogTitle,
13} from "@/registry/optics/dialog";
14import { ScrollArea } from "@/registry/optics/scroll-area";
15import { SearchIcon } from "lucide-react";
16
17function Command({ className = "", ...props }) {
18 return (
19 <CommandPrimitive
20 data-slot="command"
21 className={cn(
22 "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-2xl",
23 className,
24 )}
25 {...props}
26 />
27 );
28}
29
30function CommandDialog({
31 title = "Command Palette",
32 description = "Search for a command to run...",
33 children = null,
34 className = "",
35 showCloseButton = false,
36 ...props
37}) {
38 return (
39 <Dialog {...props}>
40 <DialogHeader className="sr-only">
41 <DialogTitle>{title}</DialogTitle>
42 <DialogDescription>{description}</DialogDescription>
43 </DialogHeader>
44 <DialogPopup
45 className={cn("overflow-hidden", className)}
46 showCloseButton={showCloseButton}
47 containerClassName="p-0"
48 >
49 <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">
50 {children}
51 </Command>
52 </DialogPopup>
53 </Dialog>
54 );
55}
56
57function CommandInput({ className = "", ...props }) {
58 return (
59 <div
60 data-slot="command-input-wrapper"
61 className="flex h-9 items-center gap-2 border-b px-3 bg-background"
62 >
63 <SearchIcon className="size-4 shrink-0 opacity-50" />
64 <CommandPrimitive.Input
65 data-slot="command-input"
66 className={cn(
67 "placeholder:text-muted-foreground flex h-10 w-full rounded-xl bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
68 className,
69 )}
70 {...props}
71 />
72 </div>
73 );
74}
75
76function CommandList({ className = "", ...props }) {
77 return (
78 <ScrollArea
79 className={cn("max-h-[300px]", className)}
80 viewportClassName="scroll-py-1"
81 >
82 <CommandPrimitive.List
83 data-slot="command-list"
84 className="overflow-x-hidden"
85 {...props}
86 />
87 </ScrollArea>
88 );
89}
90
91function CommandEmpty({ ...props } = {}) {
92// … truncated

What it pulls in

npm packages

  • cmdk
  • lucide-react
  • clsx
  • tailwind-merge

Other registry items

  • https://optics.agusmayol.com.ar/r/dialog.json
  • https://optics.agusmayol.com.ar/r/scroll-area.json
  • https://optics.agusmayol.com.ar/r/utils.json

Files it writes

  • registry/optics/command.jsx

Facts

Registry
optics
Type
registry:component
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

Docs on optics optics.agusmayol.com.ar AgusMayol/optics on GitHub Raw registry item This item as JSON

More from optics

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionopticsComponentsFree5 deps
AlertalertopticsComponentsFree4 deps
Alert Dialogalert-dialogopticsComponentsFree4 deps
Aspect Ratioaspect-ratioopticsComponentsFree2 deps
Auto Heightauto-heightopticsComponentsFree3 deps
AvataravataropticsComponentsFree3 deps
BadgebadgeopticsComponentsFree4 deps
BreadcrumbbreadcrumbopticsComponentsFree4 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