command
fulldev-ui/commandFreeComponent
fulldev/ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by fulldev/ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.full.dev/r/command.jsonSource
1---2import type { HTMLAttributes } from "astro/types"34import { cn } from "@/lib/utils"56type Props = HTMLAttributes<"div"> & {7 label?: string8 defaultValue?: string9 defaultSearch?: string10 shouldFilter?: boolean11 loop?: boolean12 disablePointerSelection?: boolean13 vimBindings?: boolean14}1516const {17 class: className,18 label,19 defaultValue,20 defaultSearch,21 shouldFilter,22 loop,23 disablePointerSelection,24 vimBindings,25 ...props26} = Astro.props27---2829<div30 data-slot="command"31 data-label={label}32 data-default-value={defaultValue}33 data-default-search={defaultSearch}34 data-should-filter={shouldFilter}35 data-loop={loop}36 data-disable-pointer-selection={disablePointerSelection}37 data-vim-bindings={vimBindings}38 class={cn(39 "bg-popover text-popover-foreground flex size-full flex-col overflow-hidden rounded-xl! p-1",40 className41 )}42 {...props}43>44 <slot />45</div>4647<script>48 import { create } from "@data-slot/command"4950 const initCommand = () => {51 create()5253 document.querySelectorAll("[data-slot=command]").forEach((command) => {54 if (!(command instanceof HTMLElement)) return55 if (command.dataset.linkNavigation === "true") return5657 command.dataset.linkNavigation = "true"58 command.addEventListener("command:select", (event) => {59 const { detail } = event as CustomEvent<{ value?: unknown }>60 const value = detail?.value61 if (typeof value !== "string") return6263 const item = Array.from(64 command.querySelectorAll("[data-slot=command-item][href]")65 ).find((item) => item.getAttribute("data-value") === value)66 const href = item?.getAttribute("href")6768 if (href) window.location.href = href69 })70 })71 }7273 initCommand()7475 document.addEventListener("astro:page-load", initCommand)76</script>
What it pulls in
npm packages
Other registry items
Files it writes
More from fulldev/ui
All 144 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | fulldev/ui | Components | Free | 1 dep · 5 files | |
| alertalert | fulldev/ui | Components | Free | no deps · 5 files | |
| alert-dialogalert-dialog | fulldev/ui | Components | Free | 1 dep · 13 files | |
| avataravatar | fulldev/ui | Components | Free | no deps · 7 files | |
| badgebadge | fulldev/ui | Components | Free | no deps · 3 files | |
| bannerbanner | fulldev/ui | Components | Free | no deps · 3 files | |
| breadcrumbbreadcrumb | fulldev/ui | Components | Free | no deps · 8 files | |
| buttonbutton | fulldev/ui | Components | Free | no deps · 3 files |
