Select
A common form component for choosing a predefined value in a dropdown menu.
Sans-serif
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.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.Root>
Root
Prop | Type | Default | |
---|---|---|---|
alignItemToTrigger | boolean | true | |
defaultOpen | boolean | false | |
defaultValue | any | null | |
disabled | boolean | false | |
name | string | undefined | |
onOpenChange | function | undefined | |
onValueChange | function | undefined | |
open | boolean | undefined | |
readOnly | boolean | false | |
required | boolean | false | |
value | any | undefined |
Trigger
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
disabled | boolean | false | |
label | string | undefined | |
render | | React.ReactElement | undefined |
Value
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
placeholder | string | undefined | |
render | | React.ReactElement | undefined |
Icon
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Backdrop
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
container | React.Ref | HTMLElement | null | false | |
keepMounted | boolean | false | |
render | | React.ReactElement | undefined |
Positioner
Prop | Type | Default | |
---|---|---|---|
align | 'start' | 'center' | 'end' | 'start' | |
alignOffset | number | 0 | |
anchor | | React.Ref | undefined | |
arrowPadding | number | 5 | |
className | string | (state) => string | undefined | |
collisionBoundary | | 'clippingAncestors' | 'clipping-ancestors' | |
collisionPadding | number | Rect | 5 | |
container | React.Ref | HTMLElement | null | undefined | |
positionMethod | 'absolute' | 'fixed' | 'absolute' | |
render | | React.ReactElement | undefined | |
side | 'top' | 'bottom' | 'left' | 'right' | 'bottom' | |
sideOffset | number | 0 | |
sticky | boolean | false | |
trackAnchor | boolean | true |
CSS Variable | Type | |
---|---|---|
--anchor-height | number | |
--anchor-width | number | |
--available-height | number | |
--available-width | number | |
--transform-origin | string |
Popup
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
id | string | undefined | |
render | | React.ReactElement | undefined |
Arrow
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
hideWhenUncentered | boolean | false | |
render | | React.ReactElement | undefined |
Item
Prop | Type | Default | |
---|---|---|---|
disabled | boolean | false | |
label | string | undefined | |
value | any | null |
Item Text
Prop | Type | Default |
---|
Item Indicator
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
keepMounted | boolean | false | |
render | | React.ReactElement | undefined |
Group
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Group Label
Prop | Type | Default | |
---|---|---|---|
className | string | (state) => string | undefined | |
render | | React.ReactElement | undefined |
Scroll Up Arrow
Prop | Type | Default | |
---|---|---|---|
keepMounted | boolean | false |
Scroll Down Arrow
Prop | Type | Default | |
---|---|---|---|
keepMounted | boolean | false |