For AI agents: the complete documentation index is at llms.txt. Markdown versions are available by appending .md or sending Accept: text/markdown.
Reflex Logo
Docs Logo
Library

/

Forms

/

Select

Select

A select component displays a dropdown list of options for the user to pick one from. It's one of the most common form controls in web applications, use it whenever you need a user to choose a single value from a predefined list and screen space is limited.

Reflex's rx.select is a fully-featured, accessible dropdown built on Radix UI primitives. It works with simple option lists or full state-bound bindings, supports form integration, keyboard navigation, and works out-of-the-box on desktop and mobile.

When to Use Select

Use rx.select when:

  • You have more than five options and need to save vertical space
  • The user should choose exactly one option from a predefined list
  • You want a consistent dropdown that matches your app's theme

Consider alternatives when:

  • You have fewer than five options → use Radio Group for better visibility
  • Users need to select multiple values → use Checkbox groups or a multi-select pattern
  • Users should type a value rather than choose one → use Input
  • You need hierarchical or searchable options → use the low-level Select API with custom content

Basic Usage

At its simplest, pass a list of string options. The component renders a dropdown button that opens a menu of choices.

The user can click the trigger button to open the dropdown and choose a different option.

Tracking the Selected Value

In most real apps, you need to react when the user selects a value, to filter data, update a chart, save to a database, or trigger another event. Bind the select to a State var using the value prop and an on_change event handler.

You selected:

apple

This is the most common pattern. Because the select is bound to a state var, the value always reflects what's stored there, you can update it from anywhere in your app, and the select will re-render automatically.

Setting a Default Value

If you just need the select to start with a specific option chosen, without tracking the user's choice in state, use default_value. This is the simplest pattern when you only care about the value at form submission time, or when you don't need the selected value to affect anything else in your app.

Placeholder Text

When you want the select to start empty, prompting the user to make a choice, omit default_value and provide a placeholder.

Dynamic Options from State

Real applications rarely have hardcoded options. More often, options come from a database, API, or calculated from other state. Pass a state var as the options list, and the dropdown updates whenever the list changes.

Expand

Disabled State

To prevent user interaction, set disabled=True. The select renders with a muted appearance and cannot be opened.

To disable individual items rather than the whole select, use the low-level API and set disabled=True on specific rx.select.item components.

Using Select in a Form

Select components integrate cleanly with Reflex forms. The name prop sets the key used when the form is submitted, and required=True prevents submission until the user makes a choice.

Order Form

Favorite fruit

Quantity

Results:

{}
Expand

For full details on building forms, validation, and submission handling, see the Form documentation.

Mapping Display Labels to Underlying Values

When your options have separate display labels and underlying values (e.g., a user ID for the value, a name for the label), use a computed var to map between them.

Selected user ID:

user_001
Expand

For native label/value separation in the dropdown itself, use the low-level Select API and pass value= and a display label child to each rx.select.item.

Using Select Inside a Dialog

When placing a select inside a Dialog or other portal-based container, set position="popper" on the select so the dropdown menu positions itself correctly above the overlay content.

React to Open and Close Events

Beyond on_change, the on_open_change event fires when the dropdown opens or closes. Use this to trigger analytics, prefetch data, or animate related UI.

The example below uses rx.cond to swap between two badges based on whether the dropdown is open.

Open count: 0

Closed
Expand

Common Patterns

Filtering a List Based on Selection

A classic use case, the select controls what data is displayed elsewhere on the page.

MacBook Pro
Dell XPS
Expand

Cascading Selects

When one select's options depend on another's value, a common pattern for country/state, category/subcategory, etc.

Expand
  • Radio Group - inline single-selection for fewer than 5 options
  • Checkbox - single or multi-selection with visible state
  • Form - grouping selects with other inputs for submission
  • Dialog - modal dialogs that can contain selects
  • Low-level Select API - fine-grained control over trigger, content, and items

API Reference

rx.select

High level wrapper for the Select component.

rx.select(["apple", "grape", "pear"], default_value="pear",
size="1",
disabled=False,
color_scheme="tomato",
high_contrast=False,
variant="classic",
radius="none",
)
size
disabled
color_scheme
high_contrast
variant
radius

Props

PropTypeDescription
size
"1""2""3"

The size of the select trigger.

default_value
str

The value that's selected when the dropdown first renders. Use this when you want the select to start with a specific option but don't need to track the user's choice in app state. The value must match one of the options in the list. If both value and default_value are provided, value takes precedence.

value
str

The currently selected value of the dropdown. When set, the component reflects this value and you must update it via an on_change event handler. Use this when you need the selected value to drive other parts of your app, like filtering a table, updating a chart, or saving to a database. For a simpler pattern where you only need to set the initial value, use default_value instead.

default_open
bool

Whether the dropdown menu is open when the component first renders.

open
bool

Controls whether the dropdown menu is currently open. When set, you must update this prop via an on_open_change event handler. Use this to programmatically open or close the dropdown. For example, opening it automatically when a user clicks a related button elsewhere on the page, or closing it after a successful selection in a multi-step form.

name
str

The name attribute used when the select is submitted as part of an HTML form. This becomes the key in the submitted form data. If omitted, the select's value won't be included in form submissions. See Forms for more on integrating selects with form validation and submission.

disabled
bool

When True, the user cannot interact with the select. The trigger appears in a muted style and clicking has no effect.

required
bool

When True and the select is inside an rx.form.root, the form cannot be submitted until the user selects a value.

items
Sequence

The items of the select.

placeholder
str

The text shown in the trigger button when no option has been selected.

label
str

The label of the select.

color_scheme
"tomato""red""ruby""crimson""pink""plum""purple""violet""iris""indigo""blue""cyan""teal""jade""green""grass""brown""orange""sky""mint""lime""yellow""amber""gold""bronze""gray"

Overrides the theme's accent color for this specific select. Accepts any Reflex color token ("blue", "green", "red", "purple", "crimson", "orange", etc.). Useful for status-specific dropdowns. For example, a destructive action select in "red", or a success-state filter in "green". Affects the focus ring, active item highlight, and the dropdown arrow icon.

high_contrast
bool

When True, increases the contrast between the select's text and background for better readability.

variant
"classic""surface""soft""ghost"

The visual style of the trigger button.

radius
"none""small""medium""large""full"

The border radius of the trigger button. Inherits from the theme by default. Use "none" for sharp corners, "full" for a pill-shaped trigger, or pick a specific value to match your app's design system. Doesn't affect the dropdown menu radius, only the trigger button.

width
str

The width of the select.

position
"item-aligned""popper"

Controls how the dropdown menu positions itself relative to the trigger.

Event Triggers

See the full list of default event triggers
TriggerDescription
on_changeFires when the user selects a different option from the dropdown. The handler receives the new value as a string. Use this with `value` to create a fully reactive select bound to state. The event also fires when the value is updated programmatically via state, so it's a reliable signal for any value change, not just user clicks.
on_open_changeFires when the dropdown menu opens or closes. The handler receives a boolean, `True` when opening, `False` when closing. Useful for triggering analytics events, prefetching data for the dropdown options when the menu opens, or animating related UI elements (like a sidebar or tooltip) when the menu appears.
Built with Reflex