Select

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

API reference

Import the component and place its parts the following way:

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
alignItemToTriggerbooleantrue
defaultOpenbooleanfalse
defaultValueanynull
disabledbooleanfalse
namestringundefined
onOpenChange(open, event) => voidundefined
onValueChange(value, event) => voidundefined
openbooleanundefined
readOnlybooleanfalse
requiredbooleanfalse
valueanyundefined

Trigger

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

PropTypeDefault
classNamestring | (state) => stringundefined
disabledbooleanfalse
labelstringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-dirty
data-disabled
data-invalid
data-popup-open
data-pressed
data-readonly
data-required
data-touched
data-valid

Value

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

PropTypeDefault
children| React.ReactNode
| (value) => React.ReactNode
undefined
classNamestring | (state) => stringundefined
placeholderstringundefined
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
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Backdrop

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

PropTypeDefault
classNamestring | (state) => stringundefined
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-closed
data-ending-style
data-open
data-starting-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
containerReact.Ref | HTMLElement | nullundefined

Positioner

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

PropTypeDefault
align'start' | 'center' | 'end''start'
alignOffsetnumber0
anchor| React.Ref
| Element
| VirtualElement
| (() => Element | VirtualElement | null)
| null
undefined
arrowPaddingnumber5
classNamestring | (state) => stringundefined
collisionBoundary| 'clippingAncestors'
| Element
| Element[]
| Rect
'clipping-ancestors'
collisionPaddingnumber | Rect5
positionMethod'absolute' | 'fixed''absolute'
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
side| 'bottom'
| 'inline-end'
| 'inline-start'
| 'left'
| 'right'
| 'top'
'bottom'
sideOffsetnumber0
stickybooleanfalse
trackAnchorbooleantrue
Attribute
Description
data-anchor-hidden
data-open
data-side
data-unchecked
CSS Variable
Description
--anchor-height
--anchor-width
--available-height
--available-width
--transform-origin

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

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-closed
data-ending-style
data-open
data-side
data-starting-style

Arrow

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

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-anchor-hidden
data-open
data-side
data-uncentered
data-unchecked

Item

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

PropTypeDefault
disabledbooleanfalse
labelstringundefined
valueanynull

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
classNamestring | (state) => stringundefined
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Group

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

PropTypeDefault
classNamestring | (state) => stringundefined
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
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

ScrollUpArrow

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

PropTypeDefault
keepMountedbooleanfalse
Attribute
Description
data-direction
data-side
data-visible

ScrollDownArrow

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

PropTypeDefault
keepMountedbooleanfalse
Attribute
Description
data-direction
data-side
data-visible

Separator

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

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined