Dakik// Bits
Dakik.co.uk
All bits

// Forms

Listbox

Select a single or multiple items from a list.

// Rendering preview…

// Install

npx shadcn@latest add @dakik/listbox

// Usage

1import { Listbox, ListboxContent, ListboxItem, ListboxItemText } from "@/components/ui/listbox";
2
3<Listbox />

// Code

1"use client";
2
3import {
4 Listbox as ArkListbox,
5 useListboxContext,
6} from "@ark-ui/react/listbox";
7import { CheckIcon } from "lucide-react";
8import type React from "react";
9import { tv, type VariantProps } from "tailwind-variants";
10import { cn } from "@/lib/utils";
11import { MenuShortcut } from "@/registry/react/components/menu";
12
13export const useListbox = useListboxContext;
14
15export const Listbox: ArkListbox.RootComponent = (props) => {
16 const { className, ...rest } = props;
17
18 return (
19 <ArkListbox.Root
20 className={cn(
21 "w-full",
22 "flex flex-col gap-1.5",
23 "text-foreground",
24 className
25 )}
26 data-slot="listbox"
27 {...rest}
28 />

// Dependencies