Combobox

An input field that combines a text input with a dropdown list of suggestions.

Installation

Import the component from the passport-ui package.

components/example.tsx
1import { Combobox } from "passport-ui";
2import { useState } from "react";

Usage

Basic example showing how to use the component.

components/example.tsx
1const frameworks = [
2 { value: "next.js", label: "Next.js" },
3 { value: "sveltekit", label: "SvelteKit" },
4 { value: "nuxt.js", label: "Nuxt.js" },
5 { value: "remix", label: "Remix" },
6 { value: "astro", label: "Astro" },
7];
8
9function ComboboxExample() {
10 const [value, setValue] = useState<string>("");
11
12 return (
13 <div className="w-sm">
14 <Combobox
15 options={frameworks}
16 value={value}
17 onValueChange={setValue}
18 placeholder="Select framework..."
19 searchPlaceholder="Search frameworks..."
20 emptyText="No framework found."
21 />
22 </div>
23 );
24}

Additional resources

Documentation and examples are available in Storybook.