pub struct FormLabelProps {
pub children: Children,
pub class: &'static str,
pub style: &'static str,
pub id: &'static str,
pub html_for: &'static str,
pub color: Option<Color>,
pub disabled: bool,
pub error: bool,
pub filled: bool,
pub focused: bool,
pub required: bool,
pub data_testid: &'static str,
}lep only.Expand description
Props for the FormLabel component.
Renders an accessible <label> linked to a form field.
When nested inside Control, it automatically reads error,
disabled, focused, required, and color from ControlContext.
ยงExamples
use form_rs::leptos::FormLabel;
use leptos::prelude::*;
#[component]
pub fn MyLabel() -> impl IntoView {
view! { <FormLabel html_for="username">"Username"</FormLabel> }
}ยงRequired Props
- children:
Children- Label text or content.
ยงOptional Props
- class: [
&'static str]- Additional CSS class names on the
<label>.
- Additional CSS class names on the
- style: [
&'static str]- Inline CSS on the
<label>.
- Inline CSS on the
- id: [
&'static str]idattribute on the<label>.
- html_for: [
&'static str]- The
idof the labeled<input>.
- The
- color:
Color- Color theme override.
- disabled:
bool- When
true, renders in disabled style.
- When
- error:
bool- When
true, renders in error color.
- When
- filled:
bool- When
true, applies the filled modifier.
- When
- focused:
bool- When
true, applies the focused modifier.
- When
- required:
bool- When
true, shows a required asterisk.
- When
- data_testid: [
&'static str]data-testidfor automated testing.
Fieldsยง
ยงchildren: ChildrenLabel text or content.
class: &'static strAdditional CSS class names on the <label>.
style: &'static strInline CSS on the <label>.
id: &'static strid attribute on the <label>.
html_for: &'static strThe id of the labeled <input>.
color: Option<Color>Color theme override.
disabled: boolWhen true, renders in disabled style.
error: boolWhen true, renders in error color.
filled: boolWhen true, applies the filled modifier.
focused: boolWhen true, applies the focused modifier.
required: boolWhen true, shows a required asterisk.
data_testid: &'static strdata-testid for automated testing.
Implementationsยง
Sourceยงimpl FormLabelProps
impl FormLabelProps
Sourcepub fn builder() -> FormLabelPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder() -> FormLabelPropsBuilder<((), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building FormLabelProps.
On the builder, call .children(...), .class(...)(optional), .style(...)(optional), .id(...)(optional), .html_for(...)(optional), .color(...)(optional), .disabled(...)(optional), .error(...)(optional), .filled(...)(optional), .focused(...)(optional), .required(...)(optional), .data_testid(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of FormLabelProps.
Trait Implementationsยง
Auto Trait Implementationsยง
impl !RefUnwindSafe for FormLabelProps
impl !Sync for FormLabelProps
impl !UnwindSafe for FormLabelProps
impl Freeze for FormLabelProps
impl Send for FormLabelProps
impl Unpin for FormLabelProps
impl UnsafeUnpin for FormLabelProps
Blanket Implementationsยง
impl<Token, Builder, How> AllPropsFor<Builder, How> for Tokenwhere
Builder: Buildable<Token>,
<Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> HasAllProps<(), T> for T
Sourceยงimpl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Sourceยงfn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงfn in_current_span(self) -> Instrumented<Self> โ
fn in_current_span(self) -> Instrumented<Self> โ
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> โ
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> โ
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 moreSourceยงimpl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Sourceยงfn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self to a value of a Properties struct.Sourceยงimpl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Sourceยงfn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self to a value of a Properties struct.