Saasflare UI
Components

Combobox

Searchable select — a Popover wrapping a cmdk palette. Autocomplete with full keyboard navigation.

Installation

npx shadcn@latest add https://ui.saasflare.io/r/combobox.json
pnpm add @saasflare/ui

Usage

Loading…
"use client"import { useState } from "react"import {    Button,    Combobox,    ComboboxContent,    ComboboxEmpty,    ComboboxInput,    ComboboxItem,    ComboboxList,    ComboboxTrigger,} from "@saasflare/ui"const FRAMEWORKS = [    { value: "next", label: "Next.js" },    { value: "remix", label: "Remix" },    { value: "astro", label: "Astro" },    { value: "nuxt", label: "Nuxt" },]/** A searchable select with controlled selection state. */export function Demo() {    const [value, setValue] = useState<string>()    const selected = FRAMEWORKS.find((f) => f.value === value)    return (        <Combobox>            <ComboboxTrigger asChild>                <Button variant="outline" className="w-56 justify-between">                    {selected?.label ?? "Select framework…"}                </Button>            </ComboboxTrigger>            <ComboboxContent className="w-56">                <ComboboxInput placeholder="Search framework…" />                <ComboboxList>                    <ComboboxEmpty>No framework found.</ComboboxEmpty>                    {FRAMEWORKS.map((f) => (                        <ComboboxItem                            key={f.value}                            value={f.value}                            selected={value === f.value}                            onSelect={setValue}                        >                            {f.label}                        </ComboboxItem>                    ))}                </ComboboxList>            </ComboboxContent>        </Combobox>    )}

API Reference

ComboboxTrigger

Prop

Type

ComboboxContent

Prop

Type

ComboboxInput

Prop

Type

ComboboxList

Prop

Type

ComboboxItem

Prop

Type

ComboboxGroup

Prop

Type

ComboboxEmpty

Prop

Type

ComboboxSeparator

Prop

Type

On this page