Select

A common form component for choosing a predefined value in a dropdown menu.

API reference

Import the component and assemble its parts:

Anatomy
import { Select } from '@base-ui-components/react/select';
<Select.Root>  <Select.Trigger>    <Select.Value />    <Select.Icon />  </Select.Trigger>
  <Select.Portal>    <Select.Backdrop />    <Select.Positioner>      <Select.ScrollUpArrow />      <Select.Popup>        <Select.Arrow />        <Select.Item>          <Select.ItemText />          <Select.ItemIndicator />        </Select.Item>        <Select.Separator />        <Select.Group>          <Select.GroupLabel />        </Select.Group>      </Select.Popup>      <Select.ScrollDownArrow />    </Select.Positioner>  </Select.Portal></Select.Root>

Root

Groups all parts of the select. Doesn’t render its own HTML element.

PropTypeDefault
name

string

undefined

defaultValue

any

null

value

any

undefined

onValueChange

(value, event) => void

undefined

defaultOpen

boolean

false

open

boolean

undefined

onOpenChange

(open, event) => void

undefined

alignItemToTrigger

boolean

true

modal

boolean

true

disabled

boolean

false

readOnly

boolean

false

required

boolean

false

Trigger

A button that opens the select menu. Renders a <div> element.

PropTypeDefault
disabled

boolean

false

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-popup-open
data-pressed
data-disabled
data-readonly
data-required
data-valid
data-invalid
data-dirty
data-touched

Value

A text label of the currently selected item. Renders a <span> element.

PropTypeDefault
placeholder

string

undefined

children

| React.ReactNode
| (value) => React.ReactNode

undefined

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Icon

An icon that indicates that the trigger button opens a select menu. Renders a <span> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Backdrop

An overlay displayed beneath the menu popup. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-starting-style
data-ending-style

Portal

A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>.

PropTypeDefault
container

React.Ref | HTMLElement | null

undefined

Positioner

Positions the select menu popup against the trigger. Renders a <div> element.

PropTypeDefault
align

'start' | 'center' | 'end'

'start'

alignOffset

number

0

side

| 'bottom'
| 'inline-end'
| 'inline-start'
| 'left'
| 'right'
| 'top'

'bottom'

sideOffset

number

0

arrowPadding

number

5

anchor

| React.Ref
| Element
| VirtualElement
| (() => Element | VirtualElement | null)
| null

undefined

collisionBoundary

| 'clipping-ancestors'
| Element
| Element[]
| Rect

'clipping-ancestors'

collisionPadding

number | Rect

5

sticky

boolean

false

positionMethod

'absolute' | 'fixed'

'absolute'

trackAnchor

boolean

true

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-anchor-hidden
data-side
CSS Variable
Description
--anchor-height
--anchor-width
--available-height
--available-width
--transform-origin

A container for the select items. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-side
data-starting-style
data-ending-style

Arrow

Displays an element positioned against the select menu anchor. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-uncentered
data-anchor-hidden
data-side

Item

An individual option in the select menu. Renders a <div> element.

PropTypeDefault
label

string

undefined

value

any

null

disabled

boolean

false

ItemText

A text label of the select item. Renders a <div> element.

ItemIndicator

Indicates whether the select item is selected. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Group

Groups related select items with the corresponding label. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

GroupLabel

An accessible label that is automatically associated with its parent group. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

ScrollUpArrow

An element that scrolls the select menu down when hovered. Renders a <div> element.

PropTypeDefault
keepMounted

boolean

false

Attribute
Description
data-direction
data-side
data-visible

ScrollDownArrow

An element that scrolls the select menu down when hovered. Renders a <div> element.

PropTypeDefault
keepMounted

boolean

false

Attribute
Description
data-direction
data-side
data-visible

Separator

A separator element accessible to screen readers. Renders a <div> element.

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined