Skip to main content

euv_ui/component/form/
struct.rs

1use super::*;
2
3/// Cross-platform reactive text input field with placeholder, masking, and change callback.
4#[derive(Clone, CustomDebug, Data, New, Props)]
5pub struct EuvInput {
6    /// Reactive bound value signal.
7    #[get(type(copy))]
8    pub(crate) value: Signal<String>,
9    /// Placeholder text.
10    pub(crate) placeholder: String,
11    /// Password masking flag.
12    #[new(skip)]
13    #[get(type(copy))]
14    #[prop(custom)]
15    pub(crate) password: bool,
16    /// Disabled flag.
17    #[new(skip)]
18    #[get(type(copy))]
19    #[prop(custom)]
20    pub(crate) disabled: bool,
21    /// Removes outer border and background for seamless embedding inside `EuvInputGroup`.
22    #[new(skip)]
23    #[get(type(copy))]
24    #[prop(custom)]
25    pub(crate) borderless: bool,
26    /// Active theme tokens.
27    #[get(type(copy))]
28    pub(crate) tokens: ThemeTokens,
29}
30
31/// Labeled form field wrapper combining label, control node, and optional error caption.
32#[derive(Clone, Data, Debug, New, Props)]
33pub struct EuvField {
34    /// Field label.
35    pub(crate) label: String,
36    /// Optional validation error message.
37    #[new(skip)]
38    #[prop(custom)]
39    pub(crate) error: String,
40    /// Mounted input/select control node.
41    #[get(type(copy))]
42    pub(crate) control: NodeId,
43    /// Active theme tokens.
44    #[get(type(copy))]
45    pub(crate) tokens: ThemeTokens,
46}
47
48/// Cross-platform reactive boolean toggle switch.
49#[derive(Clone, Data, Debug, New, Props)]
50pub struct EuvSwitch {
51    /// Reactive checked state signal.
52    #[get(type(copy))]
53    pub(crate) checked: Signal<bool>,
54    /// Label text displayed alongside the toggle.
55    pub(crate) label: String,
56    /// Active theme tokens.
57    #[get(type(copy))]
58    pub(crate) tokens: ThemeTokens,
59}
60
61/// Cross-platform reactive checkbox control.
62#[derive(Clone, Data, Debug, New, Props)]
63pub struct EuvCheckbox {
64    /// Reactive checked state signal.
65    #[get(type(copy))]
66    pub(crate) checked: Signal<bool>,
67    /// Label text displayed next to the checkbox.
68    pub(crate) label: String,
69    /// Active theme tokens.
70    #[get(type(copy))]
71    pub(crate) tokens: ThemeTokens,
72}
73
74/// Cross-platform segmented option selector.
75#[derive(Clone, Data, Debug, New, Props)]
76pub struct EuvSegmented {
77    /// Ordered option labels.
78    pub(crate) options: Vec<String>,
79    /// Reactive active index signal.
80    #[get(type(copy))]
81    pub(crate) selected: Signal<usize>,
82    /// Active theme tokens.
83    #[get(type(copy))]
84    pub(crate) tokens: ThemeTokens,
85}