BaseSelect
Compose a custom listbox with selection, navigation, and popup ownership.
Use BaseSelect to build a custom selection control from a trigger and listbox parts. It manages selected values, open state, keyboard navigation, and native form values. Your application owns filtering, query text, grouping, and item creation.
For a ready-made field, start with Select, Combobox, or MultiSelect.
Basic usage#
Playground#
Anatomy#
Control is an optional layout container and floating anchor; without it, Content uses the registered focus owner as its anchor.
Usage#
Control and focus ownership#
Control is an optional, non-interactive layout container and floating anchor. It does not toggle,
own keyboard navigation, become a tab stop, or receive role="combobox". Trigger is the primary
select-like focus owner and activator. If Control is omitted, Content falls back to the registered
focus owner for positioning.
Standard composition#
Custom searchable composition#
The input helper registers focusOwner; it never becomes the floating anchor. The caller owns the
physical input, canonical source, filtering, and query cleanup. No BaseSelect.Trigger is required
for this editable composition.
Item fields#
BaseSelect.Item accepts collection item data via the item prop: <BaseSelect.Item item={item} />.
Ordinary component props are DOM/rendering props for the rendered <div>. Custom item fields are
available through render state: <BaseSelect.Item<MyItem> item={item}>{(state) => state.item.custom}</BaseSelect.Item>,
and arbitrary item fields never leak into rendered DOM attributes.
Filtered collections#
By default, <BaseSelect items={items}> uses items as both the canonical data source and the
active navigation collection.
For custom filtered compositions (such as searchable controls), provide getItemByValue alongside
a filtered items view:
The filtered items array controls which options users can navigate. getItemByValue looks up
selected items in the full collection, so labels, disabled state, and form values remain available
when an item is filtered out.
Styling#
BaseSelect exposes control, trigger, content, listbox, item, group, groupLabel,
and direct class or style on the part that renders the element. See Customization
and Theming for nested Provider, Portal, and class-merging behavior.
Examples#
Multiple selection#
Form integration#
Attributes#
data-closedSlot: base-select-control, base-select-trigger, base-select-contentDescription: Present when disclosure or transition content is closed.data-disabledSlot: base-select-control, base-select-trigger, base-select-itemDescription: Present when the component, slot, or item is disabled.data-expandedSlot: base-select-control, base-select-trigger, base-select-contentDescription: Present when the panel, accordion, or menu is expanded.data-invalidSlot: base-select-control, base-select-triggerDescription: Present when the field or form has a validation error.data-readonlySlot: base-select-controlDescription: Present when the field is in read-only mode.data-requiredSlot: base-select-controlDescription: Present when the field input is required.data-sideSlot: base-select-contentDescription: Stores the resolved floating or drawer content side.data-highlightedSlot: base-select-itemDescription: Present when the item is highlighted by pointer or keyboard navigation.data-selectedSlot: base-select-itemDescription: Present when the item or tab is selected.Props#
BaseSelect#
Control#
Renders a <div> element by default.
Trigger#
Renders a <button> element by default.
Content#
Renders a <div> element by default.
Listbox#
Item#
Renders a <div> element by default.