Command
solid-ui/commandFreeComponent
A command component
Live preview
live · rendered by the registry
Rendered by solid-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.solid-ui.com/r/command.jsonSource
1import type { Component, ComponentProps, ParentProps, VoidProps } from "solid-js"2import { splitProps } from "solid-js"34import type { DialogRootProps } from "@kobalte/core/dialog"5import * as CommandPrimitive from "cmdk-solid"67import { cn } from "~/lib/utils"8import { Dialog, DialogContent } from "~/registry/ui/dialog"910const Command: Component<ParentProps<CommandPrimitive.CommandRootProps>> = (props) => {11 const [local, others] = splitProps(props, ["class"])1213 return (14 <CommandPrimitive.CommandRoot15 class={cn(16 "flex size-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground blur-none",17 local.class18 )}19 {...others}20 />21 )22}2324const CommandDialog: Component<ParentProps<DialogRootProps>> = (props) => {25 const [local, others] = splitProps(props, ["children"])2627 return (28 <Dialog {...others}>29 <DialogContent class="overflow-hidden p-0">30 <Command class="[&_[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-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5">31 {local.children}32 </Command>33 </DialogContent>34 </Dialog>35 )36}3738const CommandInput: Component<VoidProps<CommandPrimitive.CommandInputProps>> = (props) => {39 const [local, others] = splitProps(props, ["class"])4041 return (42 <div class="flex items-center border-b px-3" cmdk-input-wrapper="">43 <svg44 xmlns="http://www.w3.org/2000/svg"45 viewBox="0 0 24 24"46 fill="none"47 stroke="currentColor"48 stroke-width="2"49 stroke-linecap="round"50 stroke-linejoin="round"51 class="mr-2 size-4 shrink-0 opacity-50"52 >53 <path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" />54 <path d="M21 21l-6 -6" />55 </svg>56 <CommandPrimitive.CommandInput57 class={cn(58 "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",59 local.class60 )}61 {...others}62 />63 </div>64 )65}6667const CommandList: Component<ParentProps<CommandPrimitive.CommandListProps>> = (props) => {68 const [local, others] = splitProps(props, ["class"])6970 return (71 <CommandPrimitive.CommandList72// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from solid-ui
All 55 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | solid-ui | Components | Free | 2 deps | |
| Alertalert | solid-ui | Components | Free | 3 deps | |
| Alert Dialogalert-dialog | solid-ui | Components | Free | 2 deps | |
| Aspect Ratioaspect-ratio | solid-ui | Components | Free | 1 dep | |
| Avataravatar | solid-ui | Components | Free | 2 deps | |
| Badgebadge | solid-ui | Components | Free | 2 deps | |
| Badge Deltabadge-delta | solid-ui | Components | Free | 2 deps | |
| Bar Listbar-list | solid-ui | Components | Free | 1 dep |
