Command
roi-ui/commandFreeItem
A command palette component.
Install it
npx shadcn@latest add https://roiui.com/r/command.jsonSource
1"use client";23import { Autocomplete } from "@base-ui/react/autocomplete";4import { Dialog } from "@base-ui/react/dialog";5import type React from "react";6import { cn } from "@/lib/utils";7import styles from "./command.module.css";89function CommandDialog({ ...props }: Dialog.Root.Props) {10 return <Dialog.Root {...props} />;11}1213function CommandDialogTrigger({ ...props }: Dialog.Trigger.Props) {14 return <Dialog.Trigger data-slot="command-dialog-trigger" {...props} />;15}1617const CommandDialogPortal = Dialog.Portal;1819function CommandDialogBackdrop({ className, ...props }: Dialog.Backdrop.Props) {20 return <Dialog.Backdrop className={cn(styles.backdrop, className)} data-slot="command-dialog-backdrop" {...props} />;21}2223function CommandDialogPopup({24 className,25 backdropClassName,26 children,27 ...props28}: Dialog.Popup.Props & { backdropClassName?: string; children?: React.ReactNode }) {29 return (30 <CommandDialogPortal>31 <CommandDialogBackdrop className={backdropClassName} />32 <Dialog.Popup className={cn(styles.dialogPopup, className)} data-slot="command-dialog-popup" {...props}>33 {children}34 </Dialog.Popup>35 </CommandDialogPortal>36 );37}3839function Command({40 autoHighlight = "always",41 keepHighlight = true,42 className,43 ...props44}: React.ComponentProps<typeof Autocomplete.Root> & { className?: string }) {45 return (46 <div className={cn(styles.root, className)} data-slot="command">47 <Autocomplete.Root48 autoHighlight={autoHighlight}49 filter={null}50 inline51 keepHighlight={keepHighlight}52 open53 {...props}54 />55 </div>56 );57}5859function CommandInput({60 className,61 placeholder = "Search...",62 ...props63}: React.ComponentProps<typeof Autocomplete.Input>) {64 return (65 <div className={styles.inputWrapper} data-slot="command-input-wrapper">66 <Autocomplete.Input67 autoFocus68 className={cn(styles.input, className)}69 data-slot="command-input"70 placeholder={placeholder}71 {...props}72 />73 </div>74 );75}7677function CommandList({ className, ...props }: React.ComponentProps<typeof Autocomplete.List>) {78 return <Autocomplete.List className={cn(styles.list, className)} data-slot="command-list" {...props} />;79}8081function CommandEmpty({ className, children, ...props }: React.ComponentProps<typeof Autocomplete.Empty>) {82 return (83 <Autocomplete.Empty className={cn(styles.empty, className)} data-slot="command-empty" {...props}>84// … truncated
Files it writes
More from Roi UI
All 123 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | Roi UI | Other | Free | no deps · 2 files | |
| Accordion (Tailwind)accordion-tailwind | Roi UI | Other | Free | no deps | |
| AI Chatai-chat | Roi UI | Other | Free | no deps · 2 files | |
| AI Chat (Tailwind)ai-chat-tailwind | Roi UI | Other | Free | no deps | |
| Alertalert | Roi UI | Other | Free | 1 dep · 2 files | |
| Alert Dialogalert-dialog | Roi UI | Other | Free | no deps · 2 files | |
| Alert Dialog (Tailwind)alert-dialog-tailwind | Roi UI | Other | Free | no deps | |
| Alert (Tailwind)alert-tailwind | Roi UI | Other | Free | 1 dep |
