Skip to main content

euv_ui/component/input_group/view/
struct.rs

1use super::*;
2
3/// Props for the `euv_input_group` component.
4///
5/// The group is the frame the control and its addons share: one border,
6/// one focus ring, one surface.
7#[derive(Clone, CustomDebug, Data, Default, New)]
8pub struct EuvInputGroupProps {
9    /// Whether the whole group is disabled.
10    #[get(type(copy))]
11    pub disabled: Signal<bool>,
12}
13
14/// Props for the `euv_input_group_addon` component.
15///
16/// An addon is the icon, the prefix or the suffix that sits beside the
17/// control.
18#[derive(Clone, CustomDebug, Data, Default, New)]
19pub struct EuvInputGroupAddonProps {
20    /// Where the addon sits relative to the control.
21    #[get(type(copy))]
22    pub align: EuvInputGroupAlign,
23}
24
25/// Props for the `euv_input_group_button` component.
26#[derive(Clone, CustomDebug, Data, Default, New)]
27pub struct EuvInputGroupButtonProps {
28    /// The size of the button.
29    #[get(type(copy))]
30    pub size: EuvInputGroupButtonSize,
31    /// The label of the button.
32    #[get(type(copy))]
33    pub label: &'static str,
34    /// Optional click event handler.
35    #[debug(skip)]
36    pub onclick: Option<Rc<dyn Fn(Event)>>,
37}
38
39/// Props for the `euv_input_group_text` component.
40///
41/// The text is the quiet caption that belongs to the field rather than
42/// an action of its own.
43#[derive(Clone, CustomDebug, Data, Default, New)]
44pub struct EuvInputGroupTextProps {
45    /// The text shown inside the group.
46    #[get(type(copy))]
47    pub text: &'static str,
48}
49
50/// Props for the `euv_input_group_input` component.
51///
52/// The control is the single-line field of the group; the group draws
53/// the frame around it, so the field itself carries no border.
54#[derive(Clone, CustomDebug, Data, Default, New)]
55pub struct EuvInputGroupInputProps {
56    /// The unique identifier of the input element.
57    #[get(type(copy))]
58    pub id: &'static str,
59    /// The placeholder text shown when the field is empty.
60    #[get(type(copy))]
61    pub placeholder: &'static str,
62    /// The current text (reactive signal).
63    pub value: Signal<String>,
64    /// Whether the field is disabled.
65    #[get(type(copy))]
66    pub disabled: Signal<bool>,
67    /// Optional input event handler.
68    #[debug(skip)]
69    pub oninput: Option<Rc<dyn Fn(Event)>>,
70}
71
72/// Props for the `euv_input_group_textarea` component.
73///
74/// The control is the multi-line field of the group.
75#[derive(Clone, CustomDebug, Data, Default, New)]
76pub struct EuvInputGroupTextareaProps {
77    /// The unique identifier of the textarea element.
78    #[get(type(copy))]
79    pub id: &'static str,
80    /// The placeholder text shown when the field is empty.
81    #[get(type(copy))]
82    pub placeholder: &'static str,
83    /// The current text (reactive signal).
84    pub value: Signal<String>,
85    /// The visible height of the field in rows. Zero means the default.
86    #[get(type(copy))]
87    pub rows: i32,
88    /// Whether the field is disabled.
89    #[get(type(copy))]
90    pub disabled: Signal<bool>,
91    /// Optional input event handler.
92    #[debug(skip)]
93    pub oninput: Option<Rc<dyn Fn(Event)>>,
94}