Select

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

Placeholder

A placeholder can be set to hint to the user what type of value this field expects.

Default

Set a default value to be pre-selected.

Groups

Use SelectOptGroup to organize options into categories.

Disabled

Set the disabled prop on the Select component to disable the select.

Invalid

Set the invalid prop on the Select component to toggle invalid styling.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;
use singlestage::select::*;

#[component]
pub fn SelectAnatomy() -> impl IntoView {
    view! {
        <Select>
            <SelectOptGroup>
                <SelectOption />
            </SelectOptGroup>
        </Select>
    }
}

API Reference

Select

Contains all the parts of the Select.

Custom Attributes
NameTypeDefaultDescription
defaultString""

Set the default selected value. Setting value overrides this setting.

invalidboolfalse

Toggle invalid appearance and behavior.

placeholderString""

Sets a placeholder value displayed on initial load. Setting default will override this value.

valueString""

A reactive value coupled to the currently selected item's value.

Implements global and select attributes.

SelectOptGroup

Contains a group of items for the Select.

Implements global and optgroup attributes.

SelectOption

Contains an item with a value to be selected.

Implements global and option attributes.