pub struct ToggleProps {
pub pressed: MaybeProp<bool>,
pub default_pressed: MaybeProp<bool>,
pub on_pressed_change: Option<Callback<bool>>,
pub disabled: MaybeProp<bool>,
pub on_click: Option<Callback<MouseEvent>>,
pub as_child: MaybeProp<bool>,
pub node_ref: NodeRef<AnyElement>,
pub attrs: Vec<(&'static str, Attribute)>,
pub children: ChildrenFn,
}Expand description
Props for the Toggle component.
§Required Props
- attrs:
Vec<(&'static str, Attribute)> - children:
ChildrenFn
§Optional Props
- pressed:
impl Into<MaybeProp<bool>>- The controlled state of the toggle.
- default_pressed:
impl Into<MaybeProp<bool>>- The state of the toggle when initially rendered. Use
default_pressedif you do not need to control the state of the toggle. Defaults tofalse.
- The state of the toggle when initially rendered. Use
- on_pressed_change:
impl Into<Callback<bool>>- The callback that fires when the state of the toggle changes.
- disabled:
impl Into<MaybeProp<bool>> - on_click:
impl Into<Callback<MouseEvent>> - as_child:
impl Into<MaybeProp<bool>> - node_ref:
NodeRef<AnyElement>
Fields§
§pressed: MaybeProp<bool>The controlled state of the toggle.
default_pressed: MaybeProp<bool>The state of the toggle when initially rendered. Use default_pressed if you do not need to control the state of the toggle. Defaults to false.
on_pressed_change: Option<Callback<bool>>The callback that fires when the state of the toggle changes.
disabled: MaybeProp<bool>§on_click: Option<Callback<MouseEvent>>§as_child: MaybeProp<bool>§node_ref: NodeRef<AnyElement>§attrs: Vec<(&'static str, Attribute)>§children: ChildrenFnImplementations§
Source§impl ToggleProps
impl ToggleProps
Sourcepub fn builder() -> TogglePropsBuilder<((), (), (), (), (), (), (), (), ())>
pub fn builder() -> TogglePropsBuilder<((), (), (), (), (), (), (), (), ())>
Create a builder for building ToggleProps.
On the builder, call .pressed(...)(optional), .default_pressed(...)(optional), .on_pressed_change(...)(optional), .disabled(...)(optional), .on_click(...)(optional), .as_child(...)(optional), .node_ref(...)(optional), .attrs(...)(optional), .children(...) to set the values of the fields.
Finally, call .build() to create the instance of ToggleProps.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToggleProps
impl !RefUnwindSafe for ToggleProps
impl !Send for ToggleProps
impl !Sync for ToggleProps
impl Unpin for ToggleProps
impl !UnwindSafe for ToggleProps
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> 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>
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