Dinachi

Combobox

A combobox that combines text input with a selectable popup list of options.

#Installation

npx @dinachi/cli@latest add combobox

#Usage

tsx
import {
  Combobox,
  ComboboxInput,
  ComboboxTrigger,
  ComboboxClear,
  ComboboxContent,
  ComboboxList,
  ComboboxItem,
  ComboboxGroup,
  ComboboxGroupLabel,
  ComboboxEmpty,
  ComboboxStatus,
  ComboboxSeparator,
} from "@/components/ui/combobox"

#Examples

Default Combobox

A searchable combobox for selecting from a list

Combobox with Groups

Combobox with labeled option groups

Combobox with Clear

Combobox with a clear button to reset selection

#API Reference

#Combobox (Root)

PropTypeDefaultDescription
itemsT[] | GroupedItems[]The items to display. Can be a flat array or an array of groups (objects with value and items properties). Required for filtering to work.
openOnInputClickbooleanfalseWhether the popup opens when clicking the input.
valueanyThe controlled selected value.
defaultValueanyThe uncontrolled initial selected value.
onValueChange(value: any, eventDetails) => voidCallback fired when the selected value changes.
onInputValueChange(value: string, eventDetails) => voidCallback fired when the input text changes.
onOpenChange(open: boolean, eventDetails) => voidCallback fired when the popup is opened or closed.
multiplebooleanfalseWhether multiple items can be selected.
disabledbooleanfalseWhether the component should ignore user interaction.

#ComboboxItem

PropTypeDefaultDescription
valueanyThe value of the item. Required.
insetbooleanfalseAdds extra left padding for grouped or nested option content.

#ComboboxGroup

PropTypeDefaultDescription
itemsany[]Items to be rendered within this group. Child Collection components will use these items.

#Other Parts

PropTypeDefaultDescription
ComboboxContent.portalbooleantrueWhether to render in a portal. Set to false inside Dialog or Drawer.
ComboboxTrigger.childrenReact.ReactNodeOptional trigger content. Defaults to a chevron icon.
ComboboxClear.childrenReact.ReactNodeOptional clear action content. Defaults to an X icon.