BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/adn-ui/command

Command

adn-ui/command
FreeComponent

Fast, composable command menu palette for searching and executing actions.

Live preview

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

Install it

npx shadcn@latest add https://ui.awaiden.com/r/command.json

Source

src/components/ui/command/command.tsxui.awaiden.com/r/command.json
1"use client";
2
3import "./command.css";
4import { Dialog as BaseDialog } from "@base-ui/react/dialog";
5import React, { useState } from "react";
6import { cn } from "tailwind-variants";
7
8import { CommandContext, useCommandContext } from "./command.context";
9import { commandVariants, type CommandVariants } from "./command.variants";
10
11export type CommandRootProps = CommandVariants &
12 React.HTMLAttributes<HTMLDivElement> & {
13 value?: string;
14 onValueChange?: (value: string) => void;
15 };
16
17export const CommandRoot = ({
18 children,
19 className,
20 size,
21 value,
22 onValueChange,
23 ...props
24}: CommandRootProps) => {
25 const [internalSearch, setInternalSearch] = useState("");
26 const search = value !== undefined ? value : internalSearch;
27 const setSearch = onValueChange ?? setInternalSearch;
28
29 const slots = commandVariants({ size });
30
31 return (
32 <CommandContext.Provider value={{ slots, search, setSearch }}>
33 <div className={cn(slots.root(), className)} {...props}>
34 {children}
35 </div>
36 </CommandContext.Provider>
37 );
38};
39
40export type CommandDialogProps = React.ComponentProps<typeof BaseDialog.Root> & CommandRootProps;
41
42export const CommandDialog = ({
43 children,
44 open,
45 onOpenChange,
46 defaultOpen,
47 className,
48 size,
49 ...props
50}: CommandDialogProps) => {
51 const slots = commandVariants({ size });
52
53 return (
54 <BaseDialog.Root open={open} onOpenChange={onOpenChange} defaultOpen={defaultOpen}>
55 <BaseDialog.Portal>
56 <BaseDialog.Backdrop className={slots.dialogBackdrop()} />
57 <BaseDialog.Popup className={cn(slots.dialogPopup(), className)}>
58 <CommandRoot size={size} {...props}>
59 {children}
60 </CommandRoot>
61 </BaseDialog.Popup>
62 </BaseDialog.Portal>
63 </BaseDialog.Root>
64 );
65};
66
67export type CommandInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange"> & {
68 value?: string;
69 onValueChange?: (value: string) => void;
70};
71
72export const CommandInput = ({ className, value, onValueChange, ...props }: CommandInputProps) => {
73 const { slots, search, setSearch } = useCommandContext();
74
75 const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
76 setSearch(e.target.value);
77 onValueChange?.(e.target.value);
78 };
79
80 return (
81 <div className={slots.inputWrapper()}>
82 <svg
83 className="mr-2.5 h-4 w-4 shrink-0 text-muted-foreground"
84 fill="none"
85 stroke="currentColor"
86 strokeWidth="2"
87// … truncated

What it pulls in

npm packages

  • @base-ui/react
  • tailwind-variants
  • lucide-react

Files it writes

  • src/components/ui/command/command.tsx
  • src/components/ui/command/command.variants.ts
  • src/components/ui/command/command.context.ts
  • src/components/ui/command/command.css
  • src/components/ui/command/index.ts

Facts

Registry
adn-ui
Type
registry:ui
Access
Free
Files written
5
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

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

More from adn-ui

All 46 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionadn-uiComponentsFree2 deps · 5 files
Alert Dialogalert-dialogadn-uiComponentsFree2 deps · 5 files
Aspect Ratioaspect-ratioadn-uiComponentsFree1 dep · 5 files
Autocompleteautocompleteadn-uiComponentsFree2 deps · 5 files
Avataravataradn-uiComponentsFree2 deps · 5 files
Badgebadgeadn-uiComponentsFree1 dep · 5 files
Breadcrumbbreadcrumbadn-uiComponentsFree1 dep · 5 files
Buttonbuttonadn-uiComponentsFree1 dep · 4 files
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