pub struct Input { /* private fields */ }Expand description
A text input.
let html = render_static(Input![label = "Email", name = "email", kind = "email", required = true]);
assert!(html.contains(r#"<input class="nr-field-input" type="email" placeholder=" " id="#));
assert!(html.contains(r#"data-nr-error="email""#));Implementations§
Source§impl Input
impl Input
pub fn new() -> Self
pub fn placeholder(self, v: impl Into<String>) -> Self
Sourcepub fn description(self, v: impl MaybeText) -> Self
pub fn description(self, v: impl MaybeText) -> Self
Help text under the field.
Sourcepub fn error_message(self, v: impl MaybeText) -> Self
pub fn error_message(self, v: impl MaybeText) -> Self
Error text under the field; also marks it invalid.
error_message = form.error("email") shows server validation errors.
Sourcepub fn name(self, v: impl Into<String>) -> Self
pub fn name(self, v: impl Into<String>) -> Self
Form field name. Server-action validation errors for this name appear under the field automatically.
pub fn required(self, v: bool) -> Self
pub fn disabled(self, v: bool) -> Self
pub fn readonly(self, v: bool) -> Self
pub fn size(self, v: Size) -> Self
pub fn variant(self, v: FieldVariant) -> Self
pub fn radius(self, v: Radius) -> Self
pub fn label_placement(self, v: LabelPlacement) -> Self
Sourcepub fn start_content(self, v: impl View) -> Self
pub fn start_content(self, v: impl View) -> Self
Content at the start of the box, typically an icon.
Sourcepub fn end_content(self, v: impl View) -> Self
pub fn end_content(self, v: impl View) -> Self
Content at the end of the box.
Sourcepub fn full_width(self, v: bool) -> Self
pub fn full_width(self, v: bool) -> Self
Take the full width of the container (the default).
Sourcepub fn label_class(self, v: impl Into<String>) -> Self
pub fn label_class(self, v: impl Into<String>) -> Self
Extra classes for the label.
Sourcepub fn wrapper_class(self, v: impl Into<String>) -> Self
pub fn wrapper_class(self, v: impl Into<String>) -> Self
Extra classes for the box around the control.
Sourcepub fn input_class(self, v: impl Into<String>) -> Self
pub fn input_class(self, v: impl Into<String>) -> Self
Extra classes for the control itself.
pub fn description_class(self, v: impl Into<String>) -> Self
pub fn error_class(self, v: impl Into<String>) -> Self
Sourcepub fn class(self, v: impl Into<String>) -> Self
pub fn class(self, v: impl Into<String>) -> Self
Extra classes for the outer element. They win over the defaults.
Sourcepub fn with(self, part: impl Part) -> Self
pub fn with(self, part: impl Part) -> Self
Add an attribute to the <input> (attr("autocomplete", "email"),
aria(..), …); class(..) goes to the outer element.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Input
impl !Sync for Input
impl !UnwindSafe for Input
impl Forget for Input
impl Freeze for Input
impl Move for Input
impl Send for Input
impl Unpin for Input
impl UnsafeUnpin for Input
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more