pub struct SwitchProps {
pub attrs: Attributes,
}Expand description
An on/off control for a setting.
Uses a native checkbox with the switch role. Pass checked in attrs for the
initial state. Classes apply to the wrapper, while other attributes and event
handlers go on the <input>.
ⓘ
view! {
<div class="flex items-center gap-2">
let airplane_mode = element_id(cx);
switch(attrs: attributes! { id=(&airplane_mode) checked="" })
label(attrs: attributes! { for=(&airplane_mode) }, "Airplane mode")
</div>
}Fields§
§attrs: AttributesImplementations§
Source§impl SwitchProps
impl SwitchProps
Sourcepub fn builder() -> SwitchPropsBuilder
pub fn builder() -> SwitchPropsBuilder
Returns a SwitchPropsBuilder with no properties set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SwitchProps
impl RefUnwindSafe for SwitchProps
impl Send for SwitchProps
impl Sync for SwitchProps
impl Unpin for SwitchProps
impl UnsafeUnpin for SwitchProps
impl UnwindSafe for SwitchProps
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