Introducing PrimeReact v11-alpha 🎉Discover Now
styledForm

Select

Select is used to choose an item from a collection of options.

preview

Usage#

import { Select } from '@primereact/ui/select';
<Select.Root>
    <Select.Trigger>
        <Select.Value />
        <Select.Clear />
        <Select.Indicator />
    </Select.Trigger>
    <Select.Portal>
        <Select.Positioner>
            <Select.Popup>
                <Select.Arrow />
                <Select.Header>
                    <Select.Filter />
                </Select.Header>
                <Select.List>
                    <Select.Option>
                        <Select.OptionIndicator />
                    </Select.Option>
                </Select.List>
                <Select.Empty />
                <Select.Footer />
            </Select.Popup>
        </Select.Positioner>
    </Select.Portal>
</Select.Root>

Examples#

Basic#

Choose a single value from a dropdown list of options.

basic-demo

Multiple#

Use the multiple prop to allow selecting more than one item. Place Select.OptionIndicator inside each option with a check icon to indicate the selection state.

multiple-demo

Checkmark#

Use Select.OptionIndicator inside Select.Option to display a visual checkmark next to selected options. Apply data-unselected:invisible to hide the indicator when the option is not selected.

checkmark-demo

Checkbox Selection#

Integrate Checkbox components inside options for a checkbox-based multiple selection experience with select all support.

checkbox-selection-demo

Chips#

Display selected items as removable chips by composing Chip components inside Select.Value.

chip-demo

Clear#

Use Select.Clear inside the trigger to display a clear button that resets the selection.

clear-icon-demo

Filter#

Add a search field inside the popup using Select.Header with Select.Filter to filter options. The Select.Empty component provides a message when no results match.

filter-demo

Custom Option#

Customize option content using a render function inside Select.Option that receives the option instance including the selected state.

option-demo

Group#

Simple#

Options can be grouped using the optionGroupLabel and optionGroupChildren properties.

group-demo

Custom#

Customize group headers with custom rendering by accessing the list instance inside Select.List.

custom-group-demo

Checkbox and Filter#

Combine grouped options, checkbox selection, and a filter to create a rich multi-select experience with a compact trigger that displays the selection count.

group-checkbox-filter-demo

Arrow#

Use Select.Arrow inside the popup to display a visual arrow pointing to the trigger element.

arrow-demo

Float Label#

Integrate with FloatLabel for animated label behavior with three variants: over, in, and on.

float-label-demo

Ifta Label#

Use IftaLabel for an infield top-aligned label pattern.

ifta-label-demo

Fluid#

Use the fluid property to make the select take up the full width of its container.

fluid-demo

Sizes#

Use the size property to change the size of a select.

sizes-demo

Filled#

Specify the variant="filled" property to display the component with a higher visual emphasis than the default outlined style.

filled-demo

Disabled#

Use the disabled property to disable a select.

disabled-demo

Invalid#

Specify the invalid property to display the component with a red border for validation errors.

invalid-demo

Focus Behavior#

Customize keyboard and mouse focus behavior with autoOptionFocus, selectOnFocus, and focusOnHover props.

focus-behavior-demo

API#

Sub-Components#

See Primitive API for SelectRoot, SelectTrigger, SelectList, SelectOption, and other component documentation.

Hooks#

See Headless API for useSelect hook documentation.

Accessibility#

See Select Primitive for WAI-ARIA compliance details and keyboard support.