Skip to main content

euv_ui/component/field/view/
struct.rs

1use crate::*;
2
3/// Props for the `euv_field` component.
4///
5/// Defines the strongly-typed interface for a form field with label, input, and error display.
6#[derive(Clone, CustomDebug, Data, Default)]
7pub struct EuvFieldProps {
8    /// The unique identifier for the input element.
9    #[get(type(copy))]
10    pub id: &'static str,
11    /// The HTML name attribute for the input element.
12    #[get(type(copy))]
13    pub name: &'static str,
14    /// The label text displayed above the input.
15    #[get(type(copy))]
16    pub label: &'static str,
17    /// The HTML input type (e.g. "text", "email", "password", "number").
18    #[get(type(copy))]
19    pub input_type: &'static str,
20    /// The placeholder text shown when the input is empty.
21    #[get(type(copy))]
22    pub placeholder: &'static str,
23    /// The autocomplete hint for the browser.
24    #[get(type(copy))]
25    pub autocomplete: &'static str,
26    /// The current input value.
27    #[get(type(copy))]
28    pub value: Signal<String>,
29    /// The error message signal; when non-empty, the input shows error styling. When None, no error display.
30    pub error: Option<Signal<String>>,
31    /// Optional input event handler; defaults to `on_input_value(value)` if None.
32    #[debug(skip)]
33    pub oninput: Option<Rc<dyn Fn(Event)>>,
34}