Combobox
FormSearchable autocomplete input combining a text field with a filtered dropdown list.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import { Combobox } from "@dashboardpack/core/components/ui/combobox";
import { useState } from "react";
const options = [
{ value: "design", label: "Design" },
{ value: "engineering", label: "Engineering" },
{ value: "marketing", label: "Marketing" },
];
export default function ComboboxExample() {
const [value, setValue] = useState("");
return (
<div className="w-full max-w-sm space-y-4">
<Combobox
options={options}
value={value}
onValueChange={setValue}
placeholder="Choose a team"
ariaLabel="Team"
/>
<Combobox
options={options}
value="design"
onValueChange={setValue}
disabled
placeholder="Disabled team"
/>
<p className="text-sm text-muted-foreground">
Selected: {value || "None"}. Select again to clear.
</p>
</div>
);
}Usage
Pass value/label options and keep value in state. Selecting the current option clears it. Search is local over option labels.
import { Combobox } from "@dashboardpack/core/components/ui/combobox";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| options | ComboboxOption[]Default: required | Array of { value, label } choices. |
| value | stringDefault: — | Selected option value. |
| onValueChange | (value: string) => voidDefault: required | Receives the selection, or an empty string to clear. |
| ariaLabel | stringDefault: placeholder | Accessible trigger name. |
| searchPlaceholder / emptyMessage | stringDefault: Search... / No results found. | Search and empty-state text. |
| disabled | booleanDefault: false | Disable the trigger. |