Checkbox

A tri-state checkbox control with support for checked, unchecked, and indeterminate states.

Primitive: CheckboxARIA: role="checkbox"Keyboard: Space
Receive email notifications
Send marketing emails
Disabled option
checkbox_example.rs
use stratum_leptos::*;

view! {
    <Checkbox default_checked=true>
        "Receive email notifications"
    </Checkbox>
    <Checkbox>"Send marketing emails"</Checkbox>
    <Checkbox disabled=true>"Disabled option"</Checkbox>
}

Installation

stratum add checkbox

Props

PropTypeDefaultDescription
checkedOption<TriState>NoneControlled checked state (True, False, Mixed)
default_checkedboolfalseInitial state for uncontrolled usage
disabledboolfalsePrevents interaction
requiredboolfalseMarks as required for form validation
on_changeOption<Callback<bool>>NoneFires when checked state changes
classOption<String>NoneAdditional CSS classes

Accessibility

  • Renders with role="checkbox" and aria-checked (supports "true", "false", "mixed").
  • Space key toggles the checkbox.
  • Supports aria-disabled and aria-required.

Source

Primitive: checkbox.rs
Styled: checkbox.rs