Select

Displays a list of options for the user to pick from, triggered by a button.

Basic

A simple fruit selector with five options.

With Groups

Items organized into labeled groups with a separator.

Usage

julia
using Suite

Select(
    SelectTrigger(
        SelectValue(placeholder="Select a fruit"),
    ),
    SelectContent(
        SelectItem(value="apple", "Apple"),
        SelectItem(value="banana", "Banana"),
        SelectItem(value="orange", "Orange"),
    ),
)

Keyboard Interactions

KeyAction
Arrow DownMove focus to the next item
Arrow UpMove focus to the previous item
Enter / SpaceSelect the focused item
EscapeClose the select dropdown
HomeMove focus to the first item
EndMove focus to the last item
Type-aheadSearch by typing (1s timeout)

API Reference

Select

PropTypeDefaultDescription
children...Any-Select sub-components

SelectTrigger

PropTypeDefaultDescription
children...Any-Trigger content (shows selected value)

SelectValue

PropTypeDefaultDescription
placeholderString"Select an option"Text shown when no value is selected

SelectContent

PropTypeDefaultDescription
children...Any-Content items and groups
classString""Additional CSS classes

SelectItem

PropTypeDefaultDescription
valueString-Unique value for this item (required)
disabledBoolfalseDisable this item
children...Any-Item display text

SelectGroup

PropTypeDefaultDescription
children...Any-Group label and items (container)

SelectLabel

PropTypeDefaultDescription
children...Any-Group label text

SelectSeparator

PropTypeDefaultDescription
classString""Additional CSS classes

SelectScrollUpButton

PropTypeDefaultDescription
classString""Additional CSS classes

SelectScrollDownButton

PropTypeDefaultDescription
classString""Additional CSS classes