Capítulo 29 de 43
A button-triggered dropdown for picking one option from a list, with its own scrollable viewport, scroll buttons for long lists, and two distinct positioning strategies — the most structurally complex single-value picker in the library.
Root → Trigger (→ Value + Icon), Portal → Content (→ ScrollUpButton, Viewport → Item (→ ItemText + ItemIndicator) / Group (+ Label) / Separator, ScrollDownButton, Arrow).<select>) vs. "popper" (behaves like Popover/DropdownMenu — positions relative to the trigger with side/align/collision props). Switch via a prop on Content.Value's placeholder: shown when nothing is selected; Value itself must stay unstyled for positioning to work correctly.ScrollUpButton/ScrollDownButton: appear automatically when the option list overflows Viewport, letting users scroll a long list without a visible native scrollbar.select: like Checkbox/RadioGroup, renders automatically for form compatibility; can be decoupled for advanced cases the same way.<Select.Root>
<Select.Trigger>
<Select.Value placeholder="Select a fruit…" />
<Select.Icon />
</Select.Trigger>
<Select.Portal>
<Select.Content position="popper" sideOffset={5}>
<Select.Viewport>
<Select.Item value="apple"><Select.ItemText>Apple</Select.ItemText></Select.Item>
</Select.Viewport>
</Select.Content>
</Select.Portal>
</Select.Root>
| Part | Notable props |
|---|---|
Root | value/defaultValue, onValueChange, dir, name, disabled, required |
Content | positioning mode + (in popper mode) side, align, collision props |
Item | value*, disabled, textValue (for typeahead when ItemText content isn't plain text) |
<select>'s feel; switch to "popper" mode when you need Popover-style trigger-relative placement or collision avoidance near viewport edges.ScrollUpButton/ScrollDownButton only need to be rendered — Radix shows/hides them automatically based on scroll position, no manual overflow detection required.textValue on Item when its visible content isn't a plain string.