Skip to main content

euv_ui/component/time_picker/view/
struct.rs

1use super::*;
2
3/// Props for the [`euv_time_picker`] component.
4///
5/// The selected time lives in a caller-owned [`Signal`] formatted as `HH:MM`,
6/// so the picker takes part in two-way binding with the rest of the page. The
7/// open state of the panel is owned by the component itself, so the caller
8/// never has to wire it up.
9#[derive(Clone, CustomDebug, Default)]
10pub struct EuvTimePickerProps {
11    /// The selected time, formatted "HH:MM".
12    ///
13    /// An empty string means that nothing is selected yet.
14    pub value: Signal<String>,
15    /// The text shown when nothing is selected.
16    pub placeholder: &'static str,
17    /// The group label above the control.
18    ///
19    /// An empty string renders the picker without a label.
20    pub label: &'static str,
21    /// The first hour the picker offers.
22    ///
23    /// The bound is clamped into the day, so a value above `23` offers the
24    /// last hour of the day.
25    pub min_hour: u32,
26    /// The last hour the picker offers (inclusive).
27    ///
28    /// The bound is clamped into the day, so a value above `23` offers the
29    /// last hour of the day.
30    pub max_hour: u32,
31    /// The minute step the picker offers.
32    ///
33    /// The minutes run from `0` to `59` in steps of this size; a step of zero
34    /// is treated as a step of one minute.
35    pub minute_step: u32,
36    /// The callback fired when a time is chosen.
37    #[debug(skip)]
38    pub on_change: Option<Rc<dyn Fn(&'static str)>>,
39}