Skip to main content

euv_ui/component/slider/view/
struct.rs

1use super::*;
2
3/// Props for the `euv_slider` component.
4///
5/// Defines the strongly-typed interface for a range slider. The value is
6/// owned by the caller through a `Signal<f64>` so the slider can take
7/// part in two-way binding with the rest of the page.
8#[derive(Clone, CustomDebug, Data, Default)]
9pub struct EuvSliderProps {
10    /// The unique identifier for the range input element.
11    #[get(type(copy))]
12    pub id: &'static str,
13    /// The HTML name attribute for the range input element.
14    #[get(type(copy))]
15    pub name: &'static str,
16    /// The lowest selectable value.
17    #[get(type(copy))]
18    pub min: f64,
19    /// The highest selectable value.
20    #[get(type(copy))]
21    pub max: f64,
22    /// The granularity of the selectable values.
23    #[get(type(copy))]
24    pub step: f64,
25    /// The signal bound to the current slider value.
26    #[get(type(copy))]
27    pub value: Signal<f64>,
28    /// The label text displayed above the slider track.
29    #[get(type(copy))]
30    pub label: &'static str,
31    /// Optional input event handler; the built-in handler is used when
32    /// this is `None`.
33    #[debug(skip)]
34    pub oninput: Option<Rc<dyn Fn(Event)>>,
35}
36
37/// Stateless helper functions backing the `euv_slider` component.
38///
39/// The slider needs two operations that are pure functions of their
40/// arguments — percentage mapping and the value-writing input handler.
41/// Grouping them here keeps the `#[component]` body free of arithmetic
42/// and event plumbing.
43pub struct EuvSliderHelpers;