Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Select

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

apple

The on_open_change event handler acts in a similar way to the on_change and is called when the open state of the select changes.

Submitting a form using select

The name prop is needed to submit with its owning form as part of a name/value pair.

When the required prop is True, it indicates that the user must select a value before the owning form can be submitted.

Example Form

Results:

{}

API Reference

rx.select

High level wrapper for the Select component.

PropType | ValuesDefaultInteractive
items
List
placeholder
str
label
str
color_scheme
"tomato" | "red" | ...
high_contrast
bool
variant
"classic" | "surface" | ...
radius
"none" | "small" | ...
width
str
position
"item-aligned" | "popper"
size
"1" | "2" | ...
default_value
str
value
str
default_open
bool
open
bool
name
str
disabled
bool
required
bool

Event Triggers

See the full list of default event triggers
TriggerDescription
on_change Props to rename Fired when the value of the select changes.
on_open_change Fired when the select is opened or closed.

rx.select.root

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

PropType | ValuesDefaultInteractive
size
"1" | "2" | ...
default_value
str
value
str
default_open
bool
open
bool
name
str
disabled
bool
required
bool

Event Triggers

See the full list of default event triggers
TriggerDescription
on_change Props to rename Fired when the value of the select changes.
on_open_change Fired when the select is opened or closed.

rx.select.trigger

The button that toggles the select.

PropType | ValuesDefaultInteractive
variant
"classic" | "surface" | ...
color_scheme
"tomato" | "red" | ...
radius
"none" | "small" | ...
placeholder
str

rx.select.content

The component that pops out when the select is open.

PropType | ValuesDefaultInteractive
variant
"solid" | "soft"
color_scheme
"tomato" | "red" | ...
high_contrast
bool
position
"item-aligned" | "popper"
side
"top" | "right" | ...
side_offset
int
align
"start" | "center" | ...
align_offset
int

Event Triggers

See the full list of default event triggers
TriggerDescription
on_close_auto_focus Fired when the select content is closed.
on_escape_key_down Fired when the escape key is pressed.
on_pointer_down_outside Fired when a pointer down event happens outside the select content.

rx.select.group

Used to group multiple items.

Props

No component specific props

rx.select.item

The component that contains the select items.

PropType | ValuesDefaultInteractive
value
str
disabled
bool

rx.select.label

Used to render the label of a group, it isn't focusable using arrow keys.

Props

No component specific props

rx.select.separator

Used to visually separate items in the Select.

Props

No component specific props