
Accessible select dropdown with search and keyboard navigation.
npx shadcn@latest add https://ui.edbn.me/r/select.jsonGroups all parts of the select. Doesn't render its own HTML element.
defaultValueanyInitial selected value
valueanyControlled selected value
onValueChangefunctionCalled when value changes
defaultOpenbooleanfalseInitial open state
openbooleanControlled open state
onOpenChangefunctionCalled when open state changes
disabledbooleanfalseDisable select
readOnlybooleanfalseRead-only state
requiredbooleanfalseRequired field
modalbooleantrueTrap focus in popup
alignOptionToTriggerbooleantrueAlign selected option to trigger
A button that opens the select dropdown. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-popup-open | Present when dropdown is open |
| data-disabled | Present when select is disabled |
| data-readonly | Present when select is read-only |
| data-valid | Present in valid state |
| data-invalid | Present in invalid state |
Renders the selected value as text. Renders a span element.
placeholderstringText when no value selected
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
A visual indicator icon for the select. Renders a span element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
Moves the popup to a different part of the DOM. Renders a div element.
containerElement | nullPortal container
keepMountedbooleanfalseKeep in DOM when closed
Positions the popup against the trigger. Renders a div element.
side'top' | 'bottom' | 'left' | 'right''bottom'Side relative to anchor
sideOffsetnumber0Distance from anchor
align'start' | 'center' | 'end''start'Alignment relative to side
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
| data-side | Side popup is positioned on |
| data-align | Alignment relative to side |
A container for the select options. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
An overlay displayed beneath the popup. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
| data-starting-style | Present when animating in |
| data-ending-style | Present when animating out |
An arrow element pointing to the trigger. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-side | Side the arrow is on |
| data-align | Alignment of the arrow |
| data-open | Present when popup is open |
| data-closed | Present when popup is closed |
A scrollable list of items inside the popup. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
A scroll indicator at the top of the list. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-direction | Scroll direction (up) |
A scroll indicator at the bottom of the list. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-direction | Scroll direction (down) |
An individual item in the select. Renders a div element.
valueanyOption value
labelstringOption display label
disabledbooleanfalseDisable option
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
| Attribute | Description |
|---|---|
| data-highlighted | Present when option is highlighted |
| data-selected | Present when option is selected |
| data-disabled | Present when option is disabled |
Renders the text content of an item. Renders a span element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
Indicates whether the item is selected. Renders a span element.
keepMountedbooleanfalseKeep in DOM when not selected
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
Groups related options. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function
An accessible label for an option group. Renders a div element.
classNamestring | functionCSS class name
renderReactElement | functionCustom render function