Function freya::components::Slider

source ·
pub fn Slider(_: SliderProps) -> Option<VNode>
Expand description

Controlled Slider component.

You must pass a percentage from 0.0 to 100.0 and listen for value changes with onmoved and then decide if this changes are applicable, and if so, apply them.

§Styling

Inherits a SliderTheme theme.

§Example

fn app() -> Element {
    let mut percentage = use_signal(|| 20.0);

    rsx!(
        label {
            "Value: {percentage}"
        }
        Slider {
            width: "50%",
            value: *percentage.read(),
            onmoved: move |p| {
                percentage.set(p);
            }
        }
    )
}