pub struct checkbox;Expand description
A styled native checkbox.
Pass input attributes and event handlers through attrs. Classes apply to the
wrapper, while other attributes go on the <input>. Use checked for the initial
state. The indeterminate state requires setting a DOM property and has no custom
styling.
ⓘ
view! {
<div class="flex items-center gap-2">
let terms = element_id(cx);
checkbox(attrs: attributes! { id=(&terms) name="terms" checked="" })
label(attrs: attributes! { for=(&terms) }, "Accept terms")
</div>
}Trait Implementations§
Source§impl Component for checkbox
impl Component for checkbox
Source§type Props<'__props> = CheckboxProps
type Props<'__props> = CheckboxProps
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 checkbox
impl RefUnwindSafe for checkbox
impl Send for checkbox
impl Sync for checkbox
impl Unpin for checkbox
impl UnsafeUnpin for checkbox
impl UnwindSafe for checkbox
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