zng/
slider.rs

1#![cfg(feature = "slider")]
2
3//! Slider widget, styles and properties.
4//!
5//! This widget allows selecting a value or range by dragging a selector thumb over a range line.
6//!
7//! ```
8//! # use zng::prelude::*;
9//! # let _scope = APP.defaults();
10//! let value = var(0u8);
11//! # let _ =
12//! zng::slider::Slider! {
13//!     // declare slider with single thumb
14//!     selector = zng::slider::Selector::value(value.clone(), 0, 100);
15//!     // show selected value
16//!     zng::container::child_out_bottom = Text!(value.map_debug()), 5;
17//! }
18//! # ;
19//! ```
20//!
21//! The example above creates a a slider with a single thumb that selects a `u8` value in the `0..=100` range. The [`Selector`]
22//! type also supports creating multiple thumbs and custom range conversions.
23//!
24//! # Full API
25//!
26//! See [`zng_wgt_slider`] for the full widget API.
27
28pub use zng_wgt_slider::{DefaultStyle, SLIDER_DIRECTION_VAR, Selector, SelectorValue, Slider, SliderDirection, SliderTrack, ThumbArgs};
29
30/// Slider thumb widget, styles and properties.
31///
32/// This widget represents one value/offset in a slider.
33///
34/// # Full API
35///
36/// See [`zng_wgt_slider::thumb`] for the full widget API.
37pub mod thumb {
38    pub use zng_wgt_slider::thumb::{DefaultStyle, Thumb};
39}