Combobox
Input with datalist-backed option suggestions.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import from the focused entry point below, or use the same named export from @tavojs/ui. Both are public APIs; measure the built application when comparing their bundle cost.
tsximport { Combobox } from "@tavojs/ui/combobox";The component import loads compiled component CSS. Enable tavoUi() for your project theme variables, or import @tavojs/ui/theme.css once for the package default theme. The equivalent CSS-safe component alias is @tavojs/ui/css/combobox.
When to use
Use it when
Choose something else when
Examples
These examples include imports and local state where interaction requires it. Render the exported component in a page after completing UI installation. Demo state stays in the mounted component; connect file handling, persistence, and data loading to your application as needed.
Combobox example
tsximport { Combobox } from "@tavojs/ui/combobox";
import { Field } from "@tavojs/ui";
export function ComboboxExample1() {
return (
<>
<Field id="framework-choice" label="Framework">
<Combobox name="framework" listId="framework-options" options={[{ label: "Tavo.js", value: "tavo" }]} />
</Field>
</>
);
}Common props and defaults
A curated starting point. The complete TypeScript API below includes additional props and compound member contracts.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
name | string | Required | Configures name for this component. |
options | { label: string; value: string }[] | Required | Configures options for this component. |
size | Size | — | Configures size for this component. |
listId | string | — | Configures listId for this component. |
Complete TypeScript API
Import from @tavojs/ui/combobox. Published exports: Combobox, ComboboxOption, ComboboxProps.
ComboboxProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by Combobox. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by Combobox. |
id | string | No | Inherited id attribute accepted by Combobox. |
role | string | No | Inherited role attribute accepted by Combobox. |
style | Record<string, unknown> | No | Inherited style attribute accepted by Combobox. |
title | string | No | Inherited title attribute accepted by Combobox. |
tabIndex | number | No | Inherited tabIndex attribute accepted by Combobox. |
hidden | boolean | No | Inherited hidden attribute accepted by Combobox. |
disabled | boolean | No | Inherited disabled attribute accepted by Combobox. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by Combobox. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by Combobox. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by Combobox. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by Combobox. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by Combobox. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by Combobox. |
name | string | No | Configures name for this component. |
options | ComboboxOption[] | Yes | Configures options for this component. |
size | Size | No | Configures size for this component. |
listId | string | No | Configures listId for this component. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | No component state contract is exposed; the application owns the rendered content and surrounding behavior. |
| DOM target | Native input attributes target the owned form control; wrapper-specific props stay on the documented component root. |
Anatomy and related components
This component exposes one public component root rather than a compound member API.
Limitations
Avoid Combobox when wrapping controls without labels or accessible names.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Uses native `input` plus `datalist`.
Uses native `input` plus `datalist`.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | forms |
| Component import | @tavojs/ui/combobox |
| Explicit CSS import | @tavojs/ui/css/combobox |
| Preview | Interactive preview available on this page |