Pass items (value to label), so SelectValue shows the label and not the raw value.
The sample also uses Field. One command adds them with this item:
role-select.tsx
Select
| Prop | Type | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From Base UISelect.RootBase UI docs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children | ReactNode | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| input | Ref<HTMLInputElement> | — | A ref to access the hidden input element. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name | string | — | Identifies the field when a form is submitted. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SelectTrigger
<button>| Prop | Type | Default | Description | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| size | "default""lg""sm""xs" | — | ||||||||||||
| class | string | — | ||||||||||||
From Base UISelect.TriggerBase UI docs | ||||||||||||||
| children | ReactNode | — | ||||||||||||
| disabled | boolean | — | Whether the component should ignore user interaction. | |||||||||||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | ||||||||||||
| ||||||||||||||
| ...props | <button> attributes | — | Every other attribute goes to the <button>, with a ref. | |||||||||||
SelectScrollUpButton
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
From Base UISelect.ScrollUpArrowBase UI docs | |||
| keep | boolean | false | Whether to keep the HTML element in the DOM while the select popup is not scrollable. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
SelectScrollDownButton
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
From Base UISelect.ScrollDownArrowBase UI docs | |||
| keep | boolean | false | Whether to keep the HTML element in the DOM while the select popup is not scrollable. |
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| style | — | Style applied to the element, or a function that returns a style object based on the component's state. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
SelectContent
<div>| Prop | Type | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrow | boolean | false | Show an arrow that points at the trigger. The gap grows from 4px to 8px. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backdrop | boolean | false | Put a clear layer under the popup (Base UI Select.Backdrop), for example to dim it. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| portal | — | Other Base UI props of the inner parts. A className here adds to the component classes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| positioner | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backdrop | PopupPartProps<SelectBackdropProps> | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrow | PopupPartProps<SelectArrowProps> | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| list | — | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scroll | SelectScrollUpButtonProps | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scroll | SelectScrollDownButtonProps | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From Base UISelect.PopupBase UI docs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children | ReactNode | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| final | — | Determines the element to focus when the select popup is closed. - false: Do not move focus. - true: Move focus based on the default behavior (trigger or previously focused element). - RefObject: Move focus to the ref element. - function: Called with the interaction type (mouse, touch, pen, or keyboard). Return an element to focus, true to use the default behavior, or false/undefined to do nothing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| anchor | — | An element to position the popup against. By default, the popup will be positioned against the trigger. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SelectItem
<div>| Prop | Type | Default | Description | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| class | string | — | |||||||||||||||||||||||
From Base UISelect.ItemBase UI docs | |||||||||||||||||||||||||
| children | ReactNode | — | |||||||||||||||||||||||
| value | any | null | A unique value that identifies this select item. | ||||||||||||||||||||||
| disabled | boolean | false | Whether the component should ignore user interaction. | ||||||||||||||||||||||
| |||||||||||||||||||||||||
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. | ||||||||||||||||||||||
| EnterorSpace | On the trigger, opens the list. In the list, picks the highlighted item. |
|---|---|
| Down ArroworUp Arrow | Opens the list, then moves the highlight. |
| Letters | On the closed trigger, picks the matching item. In the open list, moves the highlight to it. |
| Escape | Closes the list. |
- ComboboxPick Combobox for a long list that people filter by typing before they pick.
- Segmented ControlPick one value from a few options in one row. A pill slides to the choice, and the value goes with the form like a radio group.
- FieldPuts a label, a control, and one line of help or an error together. FieldSet groups several controls under one legend.
- AutocompletePick Autocomplete when free text is a valid value and the list only suggests.
- MenuPick Menu for a list of actions that run at once, not for a value that a form sends.
Built with
Installs with Select
- Components
- Animated Chevrons Up Down Icon,Separator









