Select
A closed, scannable list that chooses one or more values without text entry.
Usage guidelines
- Use
Selectto choose from a closed list the user can scan. UseComboboxwhen the list needs search,Autocompletefor free text with suggestions, andRadioGrouporSegmentedControlwhen every option should stay visible. - Give the trigger an accessible name: a visible
SelectLabel, a field label, oraria-labelwhen the surrounding layout already labels it visually. - Pass
itemsto the root soSelectValuerenders the label of the selected value, including before the popup first opens. - Keep the caller's value type.
Select<Value>infers it fromvalue,defaultValueanditems; do not widen a union of IDs tostring. SelectContentis at least as wide as the trigger and clamps to the viewport with Base UI's--anchor-widthand--available-width. Do not replace that sizing with a fixed width.
Anatomy
SelectContent bundles the portal, positioner, popup and scrollable list. Compose SelectPortal, SelectPositioner, SelectPopup and SelectList directly only when a surface needs positioning beyond side, align and their offsets.
Examples
Multiple selection
Pass multiple to choose more than one option from the list; the popup stays open as you toggle items. Type SelectValue<Value, true> to format the read-only array and provide placeholder text when nothing is selected.
Sizes
SelectTrigger supports small, medium (default) and large sizes.
Groups and disabled items
Group related items under a SelectGroupLabel and divide groups with SelectSeparator. A disabled item stays visible and can be highlighted, but not selected.
Typed controlled value
Control the value with value and onValueChange when another part of the page reads it. The value keeps its domain type.
Deploying to US East (Virginia) (us-east)
Keyboard
| Key | Action |
|---|---|
| EnterorSpaceorDown arroworUp arrow | Opens the popup from the trigger and highlights the selected item. |
| Down arroworUp arrow | Moves the highlight between items. |
| HomeorEnd | Highlights the first or last item. |
| Printable characters | Highlights the next matching item; on a closed trigger, selects it. |
| EnterorSpace | Selects the highlighted item and closes the popup. |
| Escape | Closes the popup and returns focus to the trigger. |
API reference
Select
Groups all parts of a single- or multiple-value select dropdown. Doesn't render its own HTML element.
| Prop | Type | Default | Details |
|---|---|---|---|
children | React.ReactNode | No default | |
inputRef | React.Ref<HTMLInputElement> | No default | |
name | string | No default | |
form | string | No default | |
autoComplete | string | No default | |
id | string | No default | |
required | boolean | false | |
readOnly | boolean | false | |
disabled | boolean | false | |
multiple | Multiple | false | |
highlightItemOnHover | boolean | true | |
defaultOpen | boolean | false | |
onOpenChange | ((open: boolean, eventDetails: SelectRootOpenChangeEventDetails) => void) | No default | |
onOpenChangeComplete | ((open: boolean) => void) | No default | |
open | boolean | No default | |
modal | boolean | true | |
actionsRef | React.RefObject<SelectRootActions | null> | No default | |
items | readonly Group<any>[] | readonly { label: React.ReactNode; value: any; }[] | Record<string, React.ReactNode> | No default | |
itemToStringLabel | ((itemValue: Value) => string) | No default | |
itemToStringValue | ((itemValue: Value) => string) | No default | |
isItemEqualToValue | ((itemValue: Value, value: Value) => boolean) | No default | |
defaultValue | SelectInputValue<Value, Multiple> | null | No default | |
value | SelectInputValue<Value, Multiple> | null | No default | |
onValueChange | ((value: SelectOutputValue<Value, Multiple> | (Multiple extends true ? never : null), eventDetails: SelectRootChangeEventDetails) => void) | No default | |
SelectContent
A styled select popup bundled with a portal, positioner, and scrollable list. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
align | 'center' | 'end' | 'start' | 'start' | |
sideOffset | number | OffsetFunction | 4 | |
children required | React.ReactNode | No default | |
className | string | ((state: SelectPopupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectPopupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectPopupState) => React.CSSProperties | undefined) | No default | |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | HTMLElement | null | void) | No default | |
side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'bottom' | |
alignOffset | number | OffsetFunction | 0 | |
| Attribute | Description |
|---|---|
data-open | Present when the select is open. |
data-closed | Present when the select is closed. |
data-starting-style | Present when the select begins animating in. |
data-ending-style | Present when the select is animating out. |
data-side | Values: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
| Variable | Description |
|---|---|
--available-width | Values: The available width between the trigger and the edge of the viewport. |
--available-height | Values: The available height between the trigger and the edge of the viewport. |
--anchor-width | Values: The anchor's width. |
--anchor-height | Values: The anchor's height. |
--transform-origin | Values: The coordinates that this element is anchored to. Used for animations and transitions. |
SelectGroup
Groups related select items with the corresponding label. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: SelectGroupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectGroupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectGroupState) => React.CSSProperties | undefined) | No default | |
SelectGroupLabel
An accessible label that is automatically associated with its parent group. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: SelectGroupLabelState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectGroupLabelState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectGroupLabelState) => React.CSSProperties | undefined) | No default | |
SelectItem
An individual option in the select popup. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
value | Value | No default | |
className | string | ((state: SelectItemState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectItemState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectItemState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | false | |
children | React.ReactNode | No default | |
disabled | boolean | false | |
label | string | No default | |
| Attribute | Description |
|---|---|
data-selected | Present when the select item is selected. |
data-highlighted | Present when the select item is highlighted. |
data-disabled | Present when the select item is disabled. |
SelectItemIndicator
Indicates whether the select item is selected. Renders a <span> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: SelectItemIndicatorState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectItemIndicatorState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectItemIndicatorState) => React.CSSProperties | undefined) | No default | |
keepMounted | boolean | No default | |
| Attribute | Description |
|---|---|
data-starting-style | Present when the indicator begins animating in. |
data-ending-style | Present when the indicator is animating out. |
SelectItemText
A text label of the select item. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: SelectItemTextState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectItemTextState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectItemTextState) => React.CSSProperties | undefined) | No default | |
SelectLabel
An accessible label that is automatically associated with the select trigger. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: FieldRootState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, FieldRootState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: FieldRootState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-disabled | Present when the component should ignore user interaction. |
data-touched | Present when the field has been touched. |
data-dirty | Present when the field value has changed from its initial value. |
data-filled | Present when the field has a value. |
data-focused | Present when the field is focused. |
SelectList
A container for the select items. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
className | string | ((state: SelectListState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectListState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectListState) => React.CSSProperties | undefined) | No default | |
SelectPopup
A container for the select list. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
children | React.ReactNode | No default | |
finalFocus | boolean | React.RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | HTMLElement | null | void) | No default | |
className | string | ((state: SelectPopupState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectPopupState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectPopupState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-open | Present when the select is open. |
data-closed | Present when the select is closed. |
data-starting-style | Present when the select begins animating in. |
data-ending-style | Present when the select is animating out. |
data-side | Values: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
SelectPortal
A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
container | HTMLElement | React.RefObject<HTMLElement | ShadowRoot | null> | ShadowRoot | null | No default | |
className | string | ((state: SelectPortalState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectPortalState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectPortalState) => React.CSSProperties | undefined) | No default | |
SelectPositioner
Positions the select popup. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
align | 'center' | 'end' | 'start' | 'start' | |
sideOffset | number | OffsetFunction | 4 | |
alignItemWithTrigger | boolean | false | |
className | string | ((state: SelectPositionerState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectPositionerState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectPositionerState) => React.CSSProperties | undefined) | No default | |
anchor | Element | React.RefObject<Element | null> | VirtualElement | (() => Element | VirtualElement | null) | null | No default | |
positionMethod | 'absolute' | 'fixed' | 'absolute' | |
side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'bottom' | |
alignOffset | number | OffsetFunction | 0 | |
collisionBoundary | Boundary | 'clipping-ancestors' | |
collisionPadding | Padding | 5 | |
sticky | boolean | false | |
arrowPadding | number | 5 | |
disableAnchorTracking | boolean | false | |
collisionAvoidance | CollisionAvoidance | No default | |
| Attribute | Description |
|---|---|
data-open | Present when the select popup is open. |
data-closed | Present when the select popup is closed. |
data-anchor-hidden | Present when the anchor is hidden. |
data-side | Values: Indicates which side the popup is positioned relative to the trigger. |
data-align | Values: Indicates how the popup is aligned relative to specified side. |
| Variable | Description |
|---|---|
--available-width | Values: The available width between the trigger and the edge of the viewport. |
--available-height | Values: The available height between the trigger and the edge of the viewport. |
--anchor-width | Values: The anchor's width. |
--anchor-height | Values: The anchor's height. |
--transform-origin | Values: The coordinates that this element is anchored to. Used for animations and transitions. |
SelectSeparator
A visual separator between items or groups. Renders a <div> element.
| Prop | Type | Default | Details |
|---|---|---|---|
orientation | 'horizontal' | 'vertical' | 'horizontal' | |
className | string | ((state: SelectSeparatorState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectSeparatorState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectSeparatorState) => React.CSSProperties | undefined) | No default | |
| Attribute | Description |
|---|---|
data-orientation | Values: The orientation of the separator. |
SelectTrigger
A button that opens the select popup. Renders a <button> element.
| Prop | Type | Default | Details |
|---|---|---|---|
size | 'large' | 'medium' | 'small' | 'medium' | |
children | React.ReactNode | No default | |
disabled | boolean | No default | |
className | string | ((state: SelectTriggerState) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectTriggerState> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectTriggerState) => React.CSSProperties | undefined) | No default | |
nativeButton | boolean | true | |
| Attribute | Description |
|---|---|
data-popup-open | Present when the corresponding select is open. |
data-pressed | Present when the trigger is pressed. |
data-disabled | Present when the select is disabled. |
data-readonly | Present when the select is readonly. |
data-popup-side | Values: Indicates which side the corresponding popup is positioned relative to its anchor. |
data-required | Present when the select is required. |
data-valid | Present when the select is in a valid state (when wrapped in Field.Root). |
data-invalid | Present when the select is in an invalid state (when wrapped in Field.Root). |
data-touched | Present when the select has been touched (when wrapped in Field.Root). |
data-dirty | Present when the select's value has changed (when wrapped in Field.Root). |
data-filled | Present when the select has a value (when wrapped in Field.Root). |
data-focused | Present when the select trigger is focused (when wrapped in Field.Root). |
data-placeholder | Present when the select doesn't have a value. |
SelectValue
A text label of the currently selected item. Renders a <span> element.
| Prop | Type | Default | Details |
|---|---|---|---|
children | ((value: SelectSelectedValue<Value, Multiple>) => React.ReactNode) | React.ReactNode | No default | |
className | string | ((state: SelectValueState<Value, Multiple>) => string | undefined) | No default | |
render | ComponentRenderFn<HTMLProps, SelectValueState<Value, Multiple>> | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | No default | |
style | React.CSSProperties | ((state: SelectValueState<Value, Multiple>) => React.CSSProperties | undefined) | No default | |
placeholder | React.ReactNode | No default | |
| Attribute | Description |
|---|---|
data-placeholder | Present when the select doesn't have a value. |