listbox
diceui-radix/listboxFreeComponent
diceui/radix publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/sadmann7/diceui/HEAD/docs/public/r/styles/radix-nova/listbox.jsonSource
1import * as ListboxPrimitive from "@diceui/listbox";2import { Check } from "lucide-react";3import type * as React from "react";4import { cn } from "@/lib/utils";56const Listbox = (({7 className,8 orientation = "vertical",9 ...props10}: React.ComponentProps<typeof ListboxPrimitive.Root>) => {11 return (12 <ListboxPrimitive.Root13 data-slot="listbox"14 orientation={orientation}15 className={cn(16 "flex gap-2 focus-visible:outline-none",17 orientation === "vertical" &&18 "flex-col *:data-[slot=listbox-group]:flex-col",19 className,20 )}21 {...props}22 />23 );24}) as ListboxPrimitive.ListboxRootComponentProps;2526function ListboxGroup({27 className,28 ...props29}: React.ComponentProps<typeof ListboxPrimitive.Group>) {30 return (31 <ListboxPrimitive.Group32 data-slot="listbox-group"33 className={cn("flex flex-col gap-2", className)}34 {...props}35 />36 );37}3839function ListboxGroupLabel({40 className,41 ...props42}: React.ComponentProps<typeof ListboxPrimitive.GroupLabel>) {43 return (44 <ListboxPrimitive.GroupLabel45 data-slot="listbox-group-label"46 className={cn(47 "px-2 pt-1 font-medium text-muted-foreground text-sm",48 className,49 )}50 {...props}51 />52 );53}5455function ListboxItem({56 className,57 ...props58}: React.ComponentProps<typeof ListboxPrimitive.Item>) {59 return (60 <ListboxPrimitive.Item61 data-slot="listbox-item"62 className={cn(63 "flex w-full cursor-default select-none items-center justify-between gap-2 rounded-md p-4 outline-hidden ring-1 ring-border focus-visible:ring-ring data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-50",64 className,65 )}66 {...props}67 />68 );69}7071function ListboxItemIndicator({72 ...props73}: React.ComponentProps<typeof ListboxPrimitive.ItemIndicator>) {74 return (75 <ListboxPrimitive.ItemIndicator76 data-slot="listbox-item-indicator"77 {...props}78 >79 <Check className="size-4" />80 </ListboxPrimitive.ItemIndicator>81 );82}8384export {85 Listbox,86 ListboxGroup,87 ListboxGroupLabel,88 ListboxItem,89 ListboxItemIndicator,90};
What it pulls in
npm packages
Files it writes
More from diceui/radix
All 58 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| action-baraction-bar | diceui/radix | Components | Free | 1 dep · 2 files | |
| angle-sliderangle-slider | diceui/radix | Components | Free | 1 dep · 3 files | |
| avatar-groupavatar-group | diceui/radix | Components | Free | 1 dep | |
| badge-overflowbadge-overflow | diceui/radix | Components | Free | 1 dep · 2 files | |
| bannerbanner | diceui/radix | Components | Free | 1 dep | |
| checkbox-groupcheckbox-group | diceui/radix | Components | Free | 1 dep | |
| circular-progresscircular-progress | diceui/radix | Components | Free | 1 dep | |
| client-onlyclient-only | diceui/radix | Components | Free | no deps |
