structyl

Combobox API

View component

The full prop reference for the Combobox component. An autocomplete input with a filtered list of options.

Import

tsx
import { Combobox } from '@structyl/styled';

Props

Root

Container/context provider for the combobox. Manages state for open, value, and input value.

PropTypeDefault
children#React.ReactNode

Child elements (Input, Content, etc.)

—
value#string

Controlled value of the selected item

—
defaultValue#string

Initial value when uncontrolled

—
onValueChange#(value: string) => void

Callback when selected value changes

—
inputValue#string

Controlled input field text

—
defaultInputValue#string

Initial input text when uncontrolled

''
onInputValueChange#(value: string) => void

Callback when input text changes

—
open#boolean

Controlled open state of dropdown

—
defaultOpen#boolean

Initial open state when uncontrolled

false
onOpenChange#(open: boolean) => void

Callback when dropdown open state changes

—
dir#'ltr' | 'rtl'

Text direction for the combobox

—
disabled#boolean

Whether the combobox is disabled

—

Input

The searchable input field. Extends HTML input element with keyboard navigation (arrow keys, enter, escape).

PropTypeDefault
asChild#boolean

Render as child; prop forwarding pattern

—
className#string

CSS classes (styled version provides default styling)

—
...htmlInputAttributes#React.ComponentPropsWithoutRef<'input'>

All standard HTML input attributes (placeholder, type, onChange, onFocus, onKeyDown, etc.)

—

Portal

Portals the dropdown content to avoid overflow issues. Wraps Content.

PropTypeDefault
children#React.ReactNode

Child elements, typically Content

—
container#Element | DocumentFragment | null

DOM element to portal into; defaults to document.body

—
forceMount#boolean

Force render content even when dropdown is closed

—

Content

Dropdown container for items. Positioned via Popper, responds to open state.

PropTypeDefault
asChild#boolean

Render as child; prop forwarding pattern

—
forceMount#boolean

Force render content even when dropdown is closed

—
side#'top' | 'right' | 'bottom' | 'left'

Preferred side to position dropdown relative to input

'bottom'
sideOffset#number

Distance in pixels between input and dropdown

4
align#'start' | 'center' | 'end'

Horizontal alignment of dropdown

'start'
avoidCollisions#boolean

Flip/shift dropdown to avoid viewport collisions

true
onEscapeKeyDown#(event: KeyboardEvent) => void

Callback when escape key pressed

—
className#string

CSS classes (styled version provides default styling)

—
...htmlDivAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes

—

Item

Individual selectable option in the dropdown. Highlighted on hover/keyboard navigation, selected via click or enter.

PropTypeDefault
value#string

Unique identifier for this option (required)

—
disabled#boolean

Whether this item is selectable

—
textValue#string

Text to set as input value when selected (defaults to value prop)

—
asChild#boolean

Render as child; prop forwarding pattern

—
className#string

CSS classes (styled version provides default styling with checkmark icon)

—
children#React.ReactNode

Label/content to display for the item

—
...htmlDivAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes

—

Empty

Shown when there are no items to display (e.g., no search results).

PropTypeDefault
children#React.ReactNode

Content to display when no items available

—
className#string

CSS classes (styled version provides default styling)

—
...htmlDivAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes

—

Group

Semantic grouping container for related items (e.g., frontend vs backend languages).

PropTypeDefault
asChild#boolean

Render as child; prop forwarding pattern

—
children#React.ReactNode

Item elements to group

—
...htmlDivAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes

—

Separator

Visual divider between groups or sections in the dropdown.

PropTypeDefault
asChild#boolean

Render as child; prop forwarding pattern

—
...htmlDivAttributes#React.ComponentPropsWithoutRef<'div'>

All standard HTML div attributes (className, style, etc.)

—

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library