About
Listbox with react-aria
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Listbox [react-aria] to your project and fits it to your theme.
Code
How Listbox [react-aria] is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import { Label } from "@/components/ui/label";
import { ListBox, ListBoxItem } from "@/components/ui/listbox";
function ListBoxSingle() {
return (
<div className="space-y-2">
<Label>Listbox with single option</Label>
<div className="overflow-hidden rounded-lg border border-input">
<ListBox
className="space-y-1 bg-background p-1 text-sm shadow-sm shadow-black/5 transition-shadow"
aria-label="Select framework"
selectionMode="single"
defaultSelectedKeys={["svelte"]}
>
<ListBoxItem id="react">React</ListBoxItem>
<ListBoxItem id="vue">Vue</ListBoxItem>
<ListBoxItem id="angular" isDisabled>Angular</ListBoxItem>
<ListBoxItem id="svelte">Svelte</ListBoxItem>
</ListBox>
</div>
<p className="mt-2 text-xs text-muted-foreground">
Built with{" "}
<a
className="underline hover:text-foreground"
href="https://react-spectrum.adobe.com/react-aria/ListBox.html"
target="_blank"
rel="noopener nofollow"
>
React Aria
</a>
</p>
</div>
);
}
export { ListBoxSingle }![Listbox [react-aria] preview](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=1080,quality=75,format=webp/https://cdn.21st.dev/user_2nElBLvklOKlAURm6W1PTu6yYFh/listbox/listbox-with-single-option/preview.png?v=1)






