UI
selectbox
The selectbox
function creates a dropdown menu in your app, allowing users to select an option from a predefined list. This is ideal for scenarios where users need to choose from multiple options.
Parameters
label
(str): The label displayed above the dropdown, describing its purpose.options
(list): A list of options that users can select from.default
(str): (Optional) The default option. Must be one of the options provided.size
(float): (Optional) The width of the component in a row. Defaults to1.0
(full row). See the Layout Guide for details.
Returns
str
containing the current value.
Usage Example
Here’s how to use the selectbox
function:
Key Features
- Customizable Options: Pass a list of options to tailor the dropdown to your needs.
- Descriptive Labels: Provide clear labels to guide users in making their selection.
- Dynamic Outputs: Capture the selected value and use it dynamically within your app.
Example Use Case
Suppose you’re building a data visualization app:
- Use a
selectbox
to let users choose a dataset to analyze or visualize. - Depending on the selection, display different charts or tables.
Why Use selectbox
?
- Simplicity: A dropdown menu is intuitive and familiar for users.
- Flexibility: It handles a wide range of options without cluttering the interface.
- Interactivity: The selected option can drive other app functionality.
Streamline user choices with the selectbox
! 🎛️
Was this page helpful?