Skip to main content

euv_ui/component/input_otp/view/
struct.rs

1use super::*;
2
3/// Props for the [`euv_input_otp`] component.
4///
5/// The field owns a single input and draws one slot per character. The
6/// text stays in the caller's signal, so the field takes part in the
7/// two-way binding of the page it lives in.
8#[derive(Clone, CustomDebug, Default)]
9pub struct EuvInputOtpProps {
10    /// The text the field is showing.
11    pub value: Signal<String>,
12    /// The number of slots the field draws.
13    pub length: usize,
14    /// Whether the field is disabled.
15    pub disabled: bool,
16    /// The accessible name of the field.
17    pub label: &'static str,
18}
19
20/// Props of the [`euv_input_otp_group`] component.
21#[derive(Clone, Copy, CustomDebug, Default)]
22pub struct EuvInputOtpGroupProps {
23    /// The accessible name of the group.
24    pub label: &'static str,
25}
26
27/// Props of the [`euv_input_otp_slot`] component.
28#[derive(Clone, Copy, CustomDebug, Default)]
29pub struct EuvInputOtpSlotProps {
30    /// The character drawn in the slot.
31    pub char: &'static str,
32    /// Whether the slot is the one the caret is in.
33    pub active: bool,
34}