Homelogologo
Sponsor

Select

Allows the selection of a value from a set of predefined choices.

Usage

import { Select } from "@elemnts-ui/react" <Select> <Select.HiddenSelect /> <Select.Label /> <Select.Control> <Select.Trigger> <Select.ValueText /> </Select.Trigger> <Select.Indicator> {/* Icon */} </Select.Indicator> <Select.ClearTrigger> {/* Clear Icon */} </Select.ClearTrigger> </Select.Control> <Select.Positioner> <Select.Content> <Select.Item /> <Select.ItemGroup> <Select.ItemGroupLabel /> <Select.Item /> </Select.ItemGroup> </Select.Content> </Select.Positioner> </Select>

With icons

This example demonstrates how to use the component with icons to enhance the user interface.

Grouping

Use Select.ItemGroup to organize select options into distinct groups, making it easier for users to navigate and choose.

Disabled

Use the disabled prop to make the select component non-interactive.

API Reference

SelectRoot

The root component

PropTypeDefault
collectionListCollection<T>-
valuestring[]-
defaultValuestring[]-
onValueChange(details: ValueChangeDetails<T>) => void-
multiplebooleanfalse
disabledboolean-
invalidboolean-
namestring-
requiredboolean-
positioningPositioningOptions-
lazyMountbooleantrue
unmountOnExitbooleantrue
classNamestring-

SelectTrigger

Opens the selection list on click.

PropTypeDefault
showClearbooleanfalse
asChildboolean-

SelectValue

Displays the selected value or placeholder

PropTypeDefault
placeholderstring-
classNamestring-
asChildboolean-

SelectContent

Renders the content of the select list.

PropTypeDefault
classNamestring-
asChildboolean-

SelectClearTrigger

Clears the selected value.

PropTypeDefault
asChildboolean-

SelectGroup

Groups items in the select list.

PropTypeDefault
asChildboolean-

SelectGroupLabel

Renders the label for a group of items in the select list.

PropTypeDefault
asChildboolean-

SelectItem

Renders an item in the select list.

PropTypeDefault
asChildboolean-
itemT-

SelectEmpty

Renders the empty state of the select list.

PropTypeDefault
asChildboolean-