pub struct InputProps {Show 23 fields
pub value: Option<String>,
pub default_value: Option<String>,
pub placeholder: Option<String>,
pub disabled: bool,
pub size: Option<InputSize>,
pub variant: Option<Variant>,
pub bordered: Option<bool>,
pub status: Option<ControlStatus>,
pub prefix: Option<Element>,
pub suffix: Option<Element>,
pub addon_before: Option<Element>,
pub addon_after: Option<Element>,
pub allow_clear: bool,
pub max_length: Option<usize>,
pub show_count: bool,
pub class: Option<String>,
pub root_class_name: Option<String>,
pub style: Option<String>,
pub class_names: Option<InputClassNames>,
pub styles: Option<InputStyles>,
pub on_change: Option<EventHandler<String>>,
pub on_press_enter: Option<EventHandler<()>>,
pub data_attributes: Option<Vec<(String, String)>>,
}Expand description
Props for a single-line text input.
Fields§
§value: Option<String>Controlled value. When set, the component will not manage internal state.
default_value: Option<String>Initial value in uncontrolled mode.
placeholder: Option<String>§disabled: bool§size: Option<InputSize>Component size.
variant: Option<Variant>Visual variant (outlined/filled/borderless).
bordered: Option<bool>@deprecated Use variant="borderless" instead.
status: Option<ControlStatus>Optional status used to style the wrapper (success/warning/error).
prefix: Option<Element>Leading element rendered inside the affix wrapper.
suffix: Option<Element>Trailing element rendered inside the affix wrapper.
addon_before: Option<Element>@deprecated Use Space.Compact instead. Content before the input.
addon_after: Option<Element>@deprecated Use Space.Compact instead. Content after the input.
allow_clear: boolWhether to show a clear icon when there is content.
max_length: Option<usize>Maximum length of input.
show_count: boolWhether to show character count.
class: Option<String>§root_class_name: Option<String>Extra class applied to root element.
style: Option<String>§class_names: Option<InputClassNames>Semantic class names for sub-parts.
styles: Option<InputStyles>Semantic styles for sub-parts.
on_change: Option<EventHandler<String>>Change event with the next string value.
on_press_enter: Option<EventHandler<()>>Triggered when pressing Enter.
data_attributes: Option<Vec<(String, String)>>Data attributes as a map of key-value pairs. Keys should be without the “data-” prefix.
For example, data_attributes: Some([("test", "value")]) will render as data-test="value".
Implementations§
Source§impl InputProps
impl InputProps
Sourcepub fn builder() -> InputPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> InputPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building InputProps.
On the builder, call .value(...)(optional), .default_value(...)(optional), .placeholder(...)(optional), .disabled(...)(optional), .size(...)(optional), .variant(...)(optional), .bordered(...)(optional), .status(...)(optional), .prefix(...)(optional), .suffix(...)(optional), .addon_before(...)(optional), .addon_after(...)(optional), .allow_clear(...)(optional), .max_length(...)(optional), .show_count(...)(optional), .class(...)(optional), .root_class_name(...)(optional), .style(...)(optional), .class_names(...)(optional), .styles(...)(optional), .on_change(...)(optional), .on_press_enter(...)(optional), .data_attributes(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of InputProps.
Trait Implementations§
Source§impl Clone for InputProps
impl Clone for InputProps
Source§fn clone(&self) -> InputProps
fn clone(&self) -> InputProps
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more