euv_ui/component/number_input/view/struct.rs
1use super::*;
2
3/// Props for the [`euv_number_input`] component.
4///
5/// The value lives in a caller-owned [`Signal`] so the field takes part in
6/// two-way binding: the steppers and the typed text both write back into it,
7/// and the caller may write into it from the outside.
8#[derive(Clone, CustomDebug, Default)]
9pub struct EuvNumberInputProps {
10 /// The current value of the field.
11 pub value: Signal<i64>,
12 /// The inclusive lower bound.
13 ///
14 /// `None` leaves the value unbounded below.
15 pub min: Option<i64>,
16 /// The inclusive upper bound.
17 ///
18 /// `None` leaves the value unbounded above.
19 pub max: Option<i64>,
20 /// The step size used by the two stepper buttons.
21 ///
22 /// A step of `0` would never move the value, so it is treated as `1`.
23 pub step: i64,
24 /// The label rendered above the field.
25 ///
26 /// An empty string renders the field without a label.
27 pub label: &'static str,
28 /// Whether the field and its steppers are inert.
29 pub disabled: bool,
30 /// The callback invoked with the new value after every change.
31 ///
32 /// It fires for stepper clicks and for typed text alike.
33 #[debug(skip)]
34 pub on_change: Option<Rc<dyn Fn(i64)>>,
35}