pub struct FormField {
pub id: String,
pub label: String,
pub input: FieldInput,
pub required: bool,
pub description: Option<String>,
pub visible: bool,
}Expand description
One row in a form.
Fields§
§id: StringStable identifier used to key errors and touched state. Should be unique.
label: StringLabel drawn in the left column.
input: FieldInputCurrent input value.
required: boolIf true, the label is suffixed with a subtle marker.
description: Option<String>Optional help text (rendered under the row when focused).
visible: boolWhen false, the row is skipped by focus navigation and not rendered. Callers toggle this dynamically for contextual fields (e.g. “default” hidden when type=Boolean has its own cycle).
Implementations§
Source§impl FormField
impl FormField
Sourcepub fn new(
id: impl Into<String>,
label: impl Into<String>,
input: FieldInput,
) -> Self
pub fn new( id: impl Into<String>, label: impl Into<String>, input: FieldInput, ) -> Self
Build a new field with sensible defaults (required = false,
description = None, visible = true).
pub fn required(self, required: bool) -> Self
pub fn description(self, d: impl Into<String>) -> Self
pub fn visible(self, visible: bool) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FormField
impl RefUnwindSafe for FormField
impl Send for FormField
impl Sync for FormField
impl Unpin for FormField
impl UnsafeUnpin for FormField
impl UnwindSafe for FormField
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more