Skip to main content

NumericSlider

Function NumericSlider 

Source
pub fn NumericSlider(props: NumericEditorProps) -> Element
Expand description

Composes the official slider with the exact editor and shared canonical callbacks.

Wide integers, absent bounds and values outside the handle domain retain only the editor. Bounds never rewrite the visible model value.

  • Complexity: O(value + draft + range + locale bytes) per transition.

ยงExamples

use adam_web_ui::{components::NumericSlider, input::{NumberKind, NumericRange}};
use dioxus::prelude::*;
fn app() -> Element {
    let mut value = use_signal(|| Some("12".to_string()));
    let range = use_signal(|| Some(NumericRange { min: "0".into(), max: "100".into() }));
    let flags = use_signal(|| false);
    rsx! { NumericSlider {
        id: "amount", label: "Amount", value, range, kind: NumberKind::Signed(32),
        step: "1", disabled: flags, readonly: flags, invalid: flags,
        locale: None, optional: false,
        on_value: move |v| value.set(v), on_error: |_| {},
    } }
}