pub struct switch;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>
}Trait Implementations§
Source§impl Component for switch
impl Component for switch
Source§type Props<'__props> = SwitchProps
type Props<'__props> = SwitchProps
The component’s properties. The lifetime covers data borrowed from
the caller.
Source§fn render<'__a, '__props>(
self,
cx: &'__a Cx,
props: Self::Props<'__props>,
) -> impl Future<Output = Result<impl View>> + Send + '__awhere
Self: '__a,
Self::Props<'__props>: '__a,
'__props: '__a,
fn render<'__a, '__props>(
self,
cx: &'__a Cx,
props: Self::Props<'__props>,
) -> impl Future<Output = Result<impl View>> + Send + '__awhere
Self: '__a,
Self::Props<'__props>: '__a,
'__props: '__a,
fn props_builder<'a>() -> <Self::Props<'a> as Props>::Builder
Auto Trait Implementations§
impl Freeze for switch
impl RefUnwindSafe for switch
impl Send for switch
impl Sync for switch
impl Unpin for switch
impl UnsafeUnpin for switch
impl UnwindSafe for switch
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