Skip to content

@sqlrooms/ui / Combobox

Variable: Combobox

const Combobox: <T>(__namedParameters) => Element & object

Compound component for Popover-based combobox selectors.

Type Declaration

NameTypeDefault value
TriggerFC<PropsWithChildren<ComboboxTriggerProps>>ComboboxTrigger
ContentFC<PropsWithChildren<ComboboxContentProps>>ComboboxContent
ItemFC<PropsWithChildren<ComboboxItemProps>>ComboboxItem

Example

tsx
<Combobox value={value} onChange={setValue}>
  <Combobox.Trigger>
    <span>{selectedLabel}</span>
  </Combobox.Trigger>
  <Combobox.Content searchable searchPlaceholder="Search...">
    {options.map((option) => (
      <Combobox.Item key={option.value} value={option.value}>
        <span>{option.label}</span>
      </Combobox.Item>
    ))}
  </Combobox.Content>
</Combobox>