russellbloxwich

Combobox

Component

About

A searchable, keyboard-navigable dropdown for picking one or multiple options from a filterable list, with removable chips for multi-select.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Combobox to your project and fits it to your theme.

Code

How Combobox is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import {
  Combobox,
  ComboboxInput,
  ComboboxContent,
  ComboboxEmpty,
  ComboboxList,
  ComboboxItem,
} from "@/components/ui/combobox";

const frameworks = ["Astro", "Next.js", "React", "SvelteKit", "Vue"];

export default function ComboboxDemo() {
  const [framework, setFramework] = React.useState<string | null>(null);

  return (
    <div className="flex min-h-[360px] w-full items-center justify-center bg-background p-10 text-foreground">
      <div className="flex w-full max-w-sm flex-col gap-3">
        <Combobox
          items={frameworks}
          value={framework}
          onValueChange={setFramework}
        >
          <ComboboxInput
            aria-label="Framework"
            placeholder="Choose a framework…"
            showClear
          />
          <ComboboxContent>
            <ComboboxEmpty>No frameworks match.</ComboboxEmpty>
            <ComboboxList>
              {frameworks.map((item) => (
                <ComboboxItem key={item} value={item}>
                  {item}
                </ComboboxItem>
              ))}
            </ComboboxList>
          </ComboboxContent>
        </Combobox>
        <p className="text-sm text-muted-foreground">
          Framework: {framework ?? "not selected"}
        </p>
      </div>
    </div>
  );
}

Dependencies

More by russellbloxwich

View all
  • Sensitive Input

    Sensitive Input

    6
  • Chart

    Chart

    5
  • Code Block

    Code Block

    5
  • Layer Card

    Layer Card

    3
  • Meter

    Meter

    2
  • Field

    Field

    2
  • Direction Provider

    Direction Provider

    2
  • Toast Notifications

    Toast Notifications

    2