Components
HeroUI v3 ListBox — an accessible, keyboard-navigable list of selectable options with single and multiple selection, sections with headers, per-item labels, descriptions, avatars and keyboard-shortcut hints, disabled items, custom selection indicators, controlled selection state, custom render functions, and windowed virtualization for large datasets. A thin re-export of the genuine @heroui/react package with @heroui/styles, so consumers install and render the real HeroUI primitive.
npx @21st-dev/cli@beta add hero_ui/heroui-list-boxLoading preview...
"use client"
import { Check } from "lucide-react"
import {
Avatar,
Description,
Label,
ListBox,
Surface,
} from "@/components/ui/heroui-list-box"
export default function CustomCheckIcon() {
return (
<Surface className="w-[256px] rounded-3xl shadow-surface">
<ListBox aria-label="Users" selectionMode="multiple">
<ListBox.Item id="1" textValue="Bob">
<Avatar size="sm">
<Avatar.Image
alt="Bob"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/blue.jpg"
/>
<Avatar.Fallback>B</Avatar.Fallback>
</Avatar>
<div className="flex flex-col">
<Label>Bob</Label>
<Description>bob@heroui.com</Description>
</div>
<ListBox.ItemIndicator>
{({ isSelected }) =>
isSelected ? (
<Check className="size-4 text-accent-soft-foreground" />
) : null
}
</ListBox.ItemIndicator>
</ListBox.Item>
<ListBox.Item id="2" textValue="Fred">
<Avatar size="sm">
<Avatar.Image
alt="Fred"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/green.jpg"
/>
<Avatar.Fallback>F</Avatar.Fallback>
</Avatar>
<div className="flex flex-col">
<Label>Fred</Label>
<Description>fred@heroui.com</Description>
</div>
<ListBox.ItemIndicator>
{({ isSelected }) =>
isSelected ? (
<Check className="size-4 text-accent-soft-foreground" />
) : null
}
</ListBox.ItemIndicator>
</ListBox.Item>
<ListBox.Item id="3" textValue="Martha">
<Avatar size="sm">
<Avatar.Image
alt="Martha"
src="https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/avatars/purple.jpg"
/>
<Avatar.Fallback>M</Avatar.Fallback>
</Avatar>
<div className="flex flex-col">
<Label>Martha</Label>
<Description>martha@heroui.com</Description>
</div>
<ListBox.ItemIndicator>
{({ isSelected }) =>
isSelected ? (
<Check className="size-4 text-accent-soft-foreground" />
) : null
}
</ListBox.ItemIndicator>
</ListBox.Item>
</ListBox>
</Surface>
)
}
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...