Theme
Customize appearance
Components
Combobox
Search a list of choices and select a matching value.
View component source ↗Preview
A minimal example to get started.
Installation
Install this component and its dependencies in a project initialized with shadcn.
pnpm dlx shadcn@latest add https://ui.hyunjoon.net/r/combobox.jsonUsage
This is the basic example. Use the Code tab above for the selected example. Adjust import aliases to match your project.
import {
Combobox,
ComboboxInput,
ComboboxContent,
ComboboxEmpty,
ComboboxList,
ComboboxItem,
} from "@/components/ui/combobox";
export default function Example() {
const languages = ["TypeScript", "JavaScript", "Python", "Swift"];
return (
<Combobox items={languages}>
<ComboboxInput placeholder="Choose a language" aria-label="Language" />
<ComboboxContent>
<ComboboxEmpty>No matches.</ComboboxEmpty>
<ComboboxList>
{(language: string) => (
<ComboboxItem key={language} value={language}>
{language}
</ComboboxItem>
)}
</ComboboxList>
</ComboboxContent>
</Combobox>
);
}
API reference
Derived from the installed component types. Native DOM props are also supported where applicable. A dash means no explicit default is documented. Some props depend on the selected mode.
Combobox
| Prop | Type | Default | Description |
|---|---|---|---|
form | string | undefinedstring | undefined | — | Identifies the form that owns the internal input. Useful when the combobox is rendered outside the form. |
filter | ((itemValue: Value, query: string, itemToString?: ((itemValue: Value) => string) | undefin…((itemValue: Value, query: string, itemToString?: ((itemValue: Value) => string) | undefined) => boolean) | null | undefined | — | Filter function used to match items vs input query. |
id | string | undefinedstring | undefined | — | The id of the component. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
disabled | boolean | undefinedboolean | undefined | false | Whether the component should ignore user interaction. |
name | string | undefinedstring | undefined | — | Identifies the field when a form is submitted. |
modal | boolean | undefinedboolean | undefined | false | Determines if the popup enters a modal state when open. - `true`: user interaction is limited to the popup: document page scroll is locked and pointer interactions on outside elements are disabled. - `false`: user interaction with the rest of the document is allowed. |
open | boolean | undefinedboolean | undefined | — | Whether the popup is currently open. Use when controlled. |
defaultOpen | boolean | undefinedboolean | undefined | false | Whether the popup is initially open. To render a controlled popup, use the `open` prop instead. |
onOpenChangeComplete | ((open: boolean) => void) | undefined((open: boolean) => void) | undefined | — | Event handler called after any animations complete when the popup is opened or closed. |
inline | boolean | undefinedboolean | undefined | false | Whether the list is rendered inline without using the popup. |
grid | boolean | undefinedboolean | undefined | false | Whether list items are presented in a grid layout. When enabled, arrow keys navigate across rows and columns inferred from DOM rows. |
required | boolean | undefinedboolean | undefined | false | Whether the user must choose a value before submitting a form. |
readOnly | boolean | undefinedboolean | undefined | false | Whether the user should be unable to choose a different option from the popup. |
openOnInputClick | boolean | undefinedboolean | undefined | true | Whether the popup opens when clicking the input. |
loopFocus | boolean | undefinedboolean | undefined | true | Whether to loop keyboard focus back to the input when the end of the list is reached while using the arrow keys. The first item can then be reached by pressing <kbd>ArrowDown</kbd> again from the input, or the last item can be reached by pressing <kbd>ArrowUp</kbd> from the input. The input is always included in the focus loop per [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/). When disabled, focus does not move when on the last element and the user presses <kbd>ArrowDown</kbd>, or when on the first element and the user presses <kbd>ArrowUp</kbd>. |
inputValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | The input value of the combobox. Use when controlled. |
defaultInputValue | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | The uncontrolled input value when initially rendered. To render a controlled input, use the `inputValue` prop instead. |
inputRef | React.Ref<HTMLInputElement> | undefinedReact.Ref<HTMLInputElement> | undefined | — | A ref to the hidden input element. |
items | readonly any[] | readonly Group<any>[] | undefinedreadonly any[] | readonly Group<any>[] | undefined | — | The items to be displayed in the list. Can be either a flat array of items or an array of groups with items. |
filteredItems | readonly any[] | readonly Group<any>[] | undefinedreadonly any[] | readonly Group<any>[] | undefined | — | Filtered items to display in the list. When provided, the list will use these items instead of filtering the `items` prop internally. Use when you want to control filtering logic externally with the `useFilter()` hook. |
virtualized | boolean | undefinedboolean | undefined | false | Whether the items are being externally virtualized. |
limit | number | undefinednumber | undefined | -1 | The maximum number of items to display in the list. |
locale | Intl.LocalesArgumentIntl.LocalesArgument | — | The locale to use for string comparison. Defaults to the user's runtime locale. |
multiple | Multiple | undefinedMultiple | undefined | false | Whether multiple items can be selected. |
autoComplete | string | undefinedstring | undefined | — | Provides a hint to the browser for autofill. |
autoHighlight | boolean | undefinedboolean | undefined | false | Whether the first matching item is highlighted automatically while filtering. |
highlightItemOnHover | boolean | undefinedboolean | undefined | true | Whether moving the pointer over items should highlight them. Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state. |
itemToStringLabel | ((itemValue: Value) => string) | undefined((itemValue: Value) => string) | undefined | — | When the item values are objects (`<Combobox.Item value={object}>`), this function converts the object value to a string representation for display in the input. If the shape of the object is `{ value, label }`, the label will be used automatically without needing to specify this prop. |
itemToStringValue | ((itemValue: Value) => string) | undefined((itemValue: Value) => string) | undefined | — | When the item values are objects (`<Combobox.Item value={object}>`), this function converts the object value to a string representation for form submission. If the shape of the object is `{ value, label }`, the value will be used automatically without needing to specify this prop. |
isItemEqualToValue | ((itemValue: Value, value: Value) => boolean) | undefined((itemValue: Value, value: Value) => boolean) | undefined | — | Custom comparison logic used to determine if a combobox item value matches the current selected value. Useful when item values are objects without matching referentially. Defaults to `Object.is` comparison. |
defaultValue | ComboboxValueType<Value, Multiple> | null | undefinedComboboxValueType<Value, Multiple> | null | undefined | — | The uncontrolled selected value of the combobox when it's initially rendered. To render a controlled combobox, use the `value` prop instead. |
actionsRef | React.RefObject<AriaCombobox.Actions | null> | undefinedReact.RefObject<AriaCombobox.Actions | null> | undefined | — | A ref to imperative actions. - `unmount`: When specified, the combobox will not be unmounted when closed. Instead, the `unmount` function must be called to unmount the combobox manually. Useful when the combobox's animation is controlled by an external library. |
onOpenChange | ((open: boolean, eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void) | undef…((open: boolean, eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void) | undefined | — | Event handler called when the popup is opened or closed. |
onInputValueChange | ((inputValue: string, eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void) | …((inputValue: string, eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void) | undefined | — | Event handler called when the input value changes. |
onItemHighlighted | ((highlightedValue: Value | undefined, eventDetails: ComboboxPrimitive.Root.HighlightEvent…((highlightedValue: Value | undefined, eventDetails: ComboboxPrimitive.Root.HighlightEventDetails) => void) | undefined | — | Callback fired when an item is highlighted or unhighlighted. Receives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed. The `reason` can be: - `'keyboard'`: the highlight changed due to keyboard navigation. - `'pointer'`: the highlight changed due to pointer hovering. - `'none'`: the highlight changed programmatically. |
value | ComboboxValueType<Value, Multiple> | null | undefinedComboboxValueType<Value, Multiple> | null | undefined | — | The selected value of the combobox. Use when controlled. |
onValueChange | ((value: ComboboxValueType<Value, Multiple> | (Multiple extends true ? never : null), even…((value: ComboboxValueType<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void) | undefined | — | Event handler called when the selected value of the combobox changes. |
ComboboxInput
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | undefinedboolean | undefined | false | Whether the component should ignore user interaction. |
ref | React.Ref<HTMLInputElement> | undefinedReact.Ref<HTMLInputElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLInputElement, HTMLInputElement>>) => void) | un…((event: BaseUIEvent<React.ChangeEvent<HTMLInputElement, HTMLInputElement>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLInputElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLInputElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLInputElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLInputElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
name | string | undefinedstring | undefined | — | Field name used in form data. |
type | React.HTMLInputTypeAttribute | undefinedReact.HTMLInputTypeAttribute | undefined | — | The native input or button behavior. |
value | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | The current value when controlled by the application. |
alt | string | undefinedstring | undefined | — | Accessible text alternative for the image. |
src | string | undefinedstring | undefined | — | URL of the displayed resource. |
multiple | boolean | undefinedboolean | undefined | — | Allows more than one value to be selected. |
max | string | number | undefinedstring | number | undefined | — | Maximum allowed value. |
min | string | number | undefinedstring | number | undefined | — | Minimum allowed value. |
step | string | number | undefinedstring | number | undefined | — | Increment between valid values. |
required | boolean | undefinedboolean | undefined | — | Whether the user must provide a value before form submission. |
checked | boolean | undefinedboolean | undefined | — | Current checked state when controlled. |
maxLength | number | undefinednumber | undefined | — | Maximum number of input characters. |
placeholder | string | undefinedstring | undefined | — | Hint shown when the control has no value. |
className | string | ((state: ComboboxInputState) => string | undefined) | undefinedstring | ((state: ComboboxInputState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxInputState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxInputState) => React.CSSProperties | undefined) | u…React.CSSProperties | ((state: ComboboxInputState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
showTrigger | boolean | undefinedboolean | undefined | true | Displays a control for opening the choice list. |
showClear | boolean | undefinedboolean | undefined | false | Displays a control for clearing the selection. |
ComboboxContent
| Prop | Type | Default | Description |
|---|---|---|---|
initialFocus | boolean | React.RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boo…boolean | React.RefObject<HTMLElement | null> | ((openType: InteractionType) => void | boolean | HTMLElement | null) | undefined | — | Determines the element to focus when the popup is opened. - `false`: Do not move focus. - `true`: Move focus based on the default behavior (first tabbable element or popup). - `RefObject`: Move focus to the ref element. - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`). Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing. |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | bo…boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => void | boolean | HTMLElement | null) | undefined | — | Determines the element to focus when the popup is closed. - `false`: Do not move focus. - `true`: Move focus based on the default behavior (trigger or previously focused element). - `RefObject`: Move focus to the ref element. - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`). Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing. |
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
className | string | ((state: ComboboxPopupState) => string | undefined) | undefinedstring | ((state: ComboboxPopupState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxPopupState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxPopupState) => React.CSSProperties | undefined) | u…React.CSSProperties | ((state: ComboboxPopupState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
align | Align | undefinedAlign | undefined | "start" | How to align the popup relative to the specified side. |
side | Side | undefinedSide | undefined | "bottom" | Which side of the anchor element to align the popup against. May automatically change to avoid collisions. |
sideOffset | number | OffsetFunction | undefinednumber | OffsetFunction | undefined | 6 | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. |
alignOffset | number | OffsetFunction | undefinednumber | OffsetFunction | undefined | 0 | Additional offset along the alignment axis in pixels. Also accepts a function that returns the offset to read the dimensions of the anchor and positioner elements, along with its side and alignment. The function takes a `data` object parameter with the following properties: - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`. - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`. - `data.side`: which side of the anchor element the positioner is aligned against. - `data.align`: how the positioner is aligned relative to the specified side. |
anchor | Element | VirtualElement | React.RefObject<Element | null> | (() => Element | VirtualEleme…Element | VirtualElement | React.RefObject<Element | null> | (() => Element | VirtualElement | null) | null | undefined | — | An element to position the popup against. By default, the popup will be positioned against the trigger. |
ComboboxList
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | ((item: any, index: number) => React.ReactNode)React.ReactNode | ((item: any, index: number) => React.ReactNode) | — | Content rendered inside this component. |
className | string | ((state: ComboboxListState) => string | undefined) | undefinedstring | ((state: ComboboxListState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
style | React.CSSProperties | ((state: ComboboxListState) => React.CSSProperties | undefined) | un…React.CSSProperties | ((state: ComboboxListState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxListState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
ComboboxItem
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | An optional click handler for the item when selected. It fires when clicking the item with the pointer, as well as when pressing `Enter` with the keyboard if the item is highlighted when the `Input` or `List` element has focus. |
index | number | undefinednumber | undefined | — | The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM. |
value | anyany | null | A unique value that identifies this item. |
disabled | boolean | undefinedboolean | undefined | false | Whether the component should ignore user interaction. |
nativeButton | boolean | undefinedboolean | undefined | false | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `true` if the rendered element is a native button. |
className | string | ((state: ComboboxItemState) => string | undefined) | undefinedstring | ((state: ComboboxItemState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
style | React.CSSProperties | ((state: ComboboxItemState) => React.CSSProperties | undefined) | un…React.CSSProperties | ((state: ComboboxItemState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxItemState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
ComboboxGroup
| Prop | Type | Default | Description |
|---|---|---|---|
items | readonly any[] | undefinedreadonly any[] | undefined | — | Items to be rendered within this group. When provided, child `Collection` components will use these items. |
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
className | string | ((state: ComboboxGroupState) => string | undefined) | undefinedstring | ((state: ComboboxGroupState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxGroupState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxGroupState) => React.CSSProperties | undefined) | u…React.CSSProperties | ((state: ComboboxGroupState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ComboboxLabel
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
className | string | ((state: ComboboxGroupLabelState) => string | undefined) | undefinedstring | ((state: ComboboxGroupLabelState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxGroupLabelState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxGroupLabelState) => React.CSSProperties | undefined…React.CSSProperties | ((state: ComboboxGroupLabelState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ComboboxCollection
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | (item: any, index: number) => React.ReactNode(item: any, index: number) => React.ReactNode | — | Content rendered inside this component. |
ComboboxEmpty
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
className | string | ((state: ComboboxEmptyState) => string | undefined) | undefinedstring | ((state: ComboboxEmptyState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxEmptyState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxEmptyState) => React.CSSProperties | undefined) | u…React.CSSProperties | ((state: ComboboxEmptyState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ComboboxSeparator
| Prop | Type | Default | Description |
|---|---|---|---|
orientation | Orientation | undefinedOrientation | undefined | 'horizontal' | The orientation of the separator. |
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
className | string | ((state: SeparatorState) => string | undefined) | undefinedstring | ((state: SeparatorState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, SeparatorState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: SeparatorState) => React.CSSProperties | undefined) | undef…React.CSSProperties | ((state: SeparatorState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ComboboxChips
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | ((state: ComboboxChipsState) => string | undefined) | undefinedstring | ((state: ComboboxChipsState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
style | React.CSSProperties | ((state: ComboboxChipsState) => React.CSSProperties | undefined) | u…React.CSSProperties | ((state: ComboboxChipsState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxChipsState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
ComboboxChip
| Prop | Type | Default | Description |
|---|---|---|---|
ref | React.Ref<HTMLDivElement> | undefinedReact.Ref<HTMLDivElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLDivElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLDivElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLDivElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
className | string | ((state: ComboboxChipState) => string | undefined) | undefinedstring | ((state: ComboboxChipState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxChipState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxChipState) => React.CSSProperties | undefined) | un…React.CSSProperties | ((state: ComboboxChipState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
showRemove | boolean | undefinedboolean | undefined | true | Configures show remove; see the accepted type. |
ComboboxChipsInput
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | undefinedboolean | undefined | false | Whether the component should ignore user interaction. |
ref | React.Ref<HTMLInputElement> | undefinedReact.Ref<HTMLInputElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLInputElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLInputElement, HTMLInputElement>>) => void) | un…((event: BaseUIEvent<React.ChangeEvent<HTMLInputElement, HTMLInputElement>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLInputElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLInputElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLInputElement, MouseEvent>>) => void) | undefined((event: BaseUIEvent<React.MouseEvent<HTMLInputElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
name | string | undefinedstring | undefined | — | Field name used in form data. |
type | React.HTMLInputTypeAttribute | undefinedReact.HTMLInputTypeAttribute | undefined | — | The native input or button behavior. |
value | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | The current value when controlled by the application. |
alt | string | undefinedstring | undefined | — | Accessible text alternative for the image. |
src | string | undefinedstring | undefined | — | URL of the displayed resource. |
multiple | boolean | undefinedboolean | undefined | — | Allows more than one value to be selected. |
max | string | number | undefinedstring | number | undefined | — | Maximum allowed value. |
min | string | number | undefinedstring | number | undefined | — | Minimum allowed value. |
step | string | number | undefinedstring | number | undefined | — | Increment between valid values. |
required | boolean | undefinedboolean | undefined | — | Whether the user must provide a value before form submission. |
checked | boolean | undefinedboolean | undefined | — | Current checked state when controlled. |
maxLength | number | undefinednumber | undefined | — | Maximum number of input characters. |
placeholder | string | undefinedstring | undefined | — | Hint shown when the control has no value. |
className | string | ((state: ComboboxInputState) => string | undefined) | undefinedstring | ((state: ComboboxInputState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxInputState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxInputState) => React.CSSProperties | undefined) | u…React.CSSProperties | ((state: ComboboxInputState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ComboboxTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | undefinedboolean | undefined | false | Whether the component should ignore user interaction. |
nativeButton | boolean | undefinedboolean | undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
ref | React.Ref<HTMLButtonElement> | undefinedReact.Ref<HTMLButtonElement> | undefined | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref). |
id | string | undefinedstring | undefined | — | Unique identifier used to associate labels and descriptions. |
children | React.ReactNodeReact.ReactNode | — | Content rendered inside this component. |
onFocus | ((event: BaseUIEvent<React.FocusEvent<HTMLButtonElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLButtonElement, Element>>) => void) | undefined | — | Called when the control receives focus. |
onBlur | ((event: BaseUIEvent<React.FocusEvent<HTMLButtonElement, Element>>) => void) | undefined((event: BaseUIEvent<React.FocusEvent<HTMLButtonElement, Element>>) => void) | undefined | — | Called when the control loses focus. |
onChange | ((event: BaseUIEvent<React.ChangeEvent<HTMLButtonElement, Element>>) => void) | undefined((event: BaseUIEvent<React.ChangeEvent<HTMLButtonElement, Element>>) => void) | undefined | — | Called when the underlying form control changes; inspect the event for its value. |
onKeyDown | ((event: BaseUIEvent<React.KeyboardEvent<HTMLButtonElement>>) => void) | undefined((event: BaseUIEvent<React.KeyboardEvent<HTMLButtonElement>>) => void) | undefined | — | Called when a key is pressed while this element is focused. |
onClick | ((event: BaseUIEvent<React.MouseEvent<HTMLButtonElement, MouseEvent>>) => void) | undefine…((event: BaseUIEvent<React.MouseEvent<HTMLButtonElement, MouseEvent>>) => void) | undefined | — | Called when the element is activated. |
name | string | undefinedstring | undefined | — | Field name used in form data. |
type | "button" | "submit" | "reset" | undefined"button" | "submit" | "reset" | undefined | — | The native input or button behavior. |
value | string | number | readonly string[] | undefinedstring | number | readonly string[] | undefined | — | The current value when controlled by the application. |
className | string | ((state: ComboboxTriggerState) => string | undefined) | undefinedstring | ((state: ComboboxTriggerState) => string | undefined) | undefined | — | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn…React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, ComboboxTriggerState> | undefined | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | React.CSSProperties | ((state: ComboboxTriggerState) => React.CSSProperties | undefined) |…React.CSSProperties | ((state: ComboboxTriggerState) => React.CSSProperties | undefined) | undefined | — | Style applied to the element, or a function that returns a style object based on the component's state. |
ComboboxValue
| Prop | Type | Default | Description |
|---|---|---|---|
children | React.ReactNode | ((selectedValue: any) => React.ReactNode)React.ReactNode | ((selectedValue: any) => React.ReactNode) | — | Content rendered inside this component. |
placeholder | React.ReactNodeReact.ReactNode | — | The placeholder value to display when no value is selected. This is overridden by `children` if specified, or by a null item's label in `items`. |
Usage notes
Pass items to the root and render options in ComboboxList. Include an empty state for searches without results.