Serafim

Listbox [react-aria]

Component 1

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 }

Dependencies

More by Serafim

View all
  • Spline Scene

    Spline Scene

    9.7K
  • Testimonials with Marquee

    Testimonials with Marquee

    2.4K
  • Gradient Button

    Gradient Button

    2K
  • Pixel Canvas

    Pixel Canvas

    923
  • Animated Blur Number

    Animated Blur Number

    834
  • Empty State

    Empty State

    797
  • Balloons

    Balloons

    788
  • Status Badge

    Status Badge

    691