apps/mantine.dev/src/pages/core/combobox-popover.mdx
import { ComboboxPopoverDemos } from '@docs/demos'; import { Layout } from '@/layout'; import { MDX_DATA } from '@/mdx';
export default Layout(MDX_DATA.ComboboxPopover);
ComboboxPopover allows adding a combobox dropdown with selectable options to any button element.
Unlike Select and MultiSelect, it does not render an input – instead, you provide your own
target element (typically a Button) via ComboboxPopover.Target.
ComboboxPopover.Target child must be a single element or component that accepts a ref.
Fragments, strings, and other primitive values are not supported.
ComboboxPopover supports the same data format as Select component:
an array of strings, objects with value and label, or grouped items.
Set searchable prop to enable a search input inside the dropdown that filters options as you type.
Use nothingFoundMessage to display a message when no options match the search query.
Use searchValue and onSearchChange props to control the search input value:
Use filter prop with searchable to provide a custom filtering and sorting function:
Use limit prop with searchable to limit the number of options displayed at a time.
This is useful for large data sets to improve performance:
Set multiple prop to allow selecting multiple values. When multiple is set,
value type changes from string | null to string[], and onChange callback
receives an array of selected values.
By default, the selected option can be deselected by clicking it again.
Set allowDeselect={false} to prevent this behavior.
Set nothingFoundMessage prop to display a message when no options are available:
Use renderOption prop to customize option rendering:
By default, the dropdown is wrapped with ScrollArea.Autosize.
Use maxDropdownHeight to control the maximum height:
Use dropdownOpened prop to control the dropdown state.
Additionally, you can use onDropdownOpen and onDropdownClose callbacks
to react to dropdown state changes.
By default, the dropdown width matches the target element. Use comboboxProps
to set a custom width:
ComboboxPopover renders a hidden input with the selected value for native form submission.
Use name prop to set the input name. For multiple selection, values are joined with a comma
by default – use hiddenInputValuesDivider to change the separator.