Componentdata1.6 KB gzipZero dependencies
Listbox
Single/multi selectable list with keyboard navigation, ARIA roles, and check marks that slide in.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add listboxOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Listbox } from "@/components/ui/listbox"; <Listbox items={items} multiple selected={selected} onSelectionChange={setSelected} />Source code
listbox.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxlistbox.tsx228 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export type ListboxOption = { value: string; label: string; disabled?: boolean;}; export type ListboxProps = { items: ListboxOption[]; multiple?: boolean; selected?: string | string[]; defaultSelected?: string | string[]; onSelectionChange?: (selected: string | string[]) => void; className?: string;Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { Listbox } from "@/components/ui/listbox"; <Listbox />| Prop | Type | Description |
|---|---|---|
| items | ListboxOption[] | Available options. |
| multiple | boolean | Allow multiple selection. |
| selected | string | string[] | Controlled selection. |
| defaultSelected | string | string[] | Uncontrolled initial selection. |
| onSelectionChange | (selected: string | string[]) => void | Change handler. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |