Knit UI
GitHub

Playground

Loading playground…

false
false
Playground
<Combobox
  size="sm"
  position="bottom"
  disabled={false}
  readOnly={false}
/>

Examples

Sizes

Demonstrates the five size tokens on the dropdown font and spacing.

Loading example…

SizesSourceStorybook

Shadows

The shadow prop lifts the dropdown off the page using the shared elevation ladder (xsxl). Each combobox below is always open and rendered inline (withinPortal={false}) inside its own relative wrapper so the dropdowns sit side by side without overlapping.

Loading example…

ShadowsSourceStorybook

Controlled

Controlled selection — the selected value and the search query are owned by the parent.

Loading example…

ControlledSourceStorybook

Grouped

Grouped options with labelled sections.

Loading example…

GroupedSourceStorybook

Disabled Option

A disabled option cannot be selected; the combobox stays open.

Loading example…

Disabled OptionSourceStorybook

Empty State

Empty state message when no options match the search query.

Loading example…

Empty StateSourceStorybook

With Header And Footer

Header and footer slots frame the option list with extra content.

Loading example…

With Header And FooterSourceStorybook

With Clear And Chevron

ClearButton and Chevron sub-components used alongside the target.

Loading example…

With Clear And ChevronSourceStorybook

Button Target

Button target — use targetType="button" when the trigger is a control (not a text field). The dropdown anchors to the button itself and a press toggles it open/closed, so no focus/blur wiring is needed.

Loading example…

Button TargetSourceStorybook

Options Dropdown

Combobox.OptionsDropdown renders parsed data into option rows for you — no hand-composed Combobox.Option list. value drives the check icon and renderOption customises each row's content.

Loading example…

Options DropdownSourceStorybook

Props

PropTypeDefaultDescription
childrenReactNode`Combobox.Target` + `Combobox.Dropdown`.
closeOnClickOutsideboolean | undefinedtrueClose on outside press (web).
closeOnEscapeboolean | undefinedtrueClose on `Escape` (web).
disabled systemboolean | undefinedfalseSkip rendering the dropdown.
keepMountedboolean | undefinedfalseKeep the dropdown mounted while closed.
offsetnumber | undefined8Gap between target and dropdown in px.
onOptionSubmit((value: string) => void) | undefinedCalled when an option is submitted (click or `Enter`).
positionPlacement | undefined
bottom · top · left · right · bottom-start · bottom-end · top-start · top-end
'bottom'Dropdown placement relative to the target.
radius systemRadiusTokens | undefinedDropdown border radius.
readOnlyboolean | undefinedfalseDropdown opens but options are presentational.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
unset · xs · sm · md · lg · xl
'md'Elevation — drop shadow from the shared ladder.
size system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
xxs · xs · sm · md · lg · xl · xxl
'md'Controls size shared to dropdown parts.
storeComboboxStore | undefinedStore created by `useCombobox`. A self-managed store is created if omitted.
widthPopoverWidth | undefined'target'Dropdown width; `'target'` matches the target.
withinPortalboolean | undefinedtrueRender the dropdown in a portal.
zIndexnumber | undefined300Dropdown `z-index`.