Checkbox

A control that allows the user to toggle between checked and not checked.

By clicking this checkbox, you agree to the terms.

Invalid State

Set invalid on either the Checkbox or a Field wrapper to display an invalid state.

Basic

Pair the checkbox with Field and Label for proper layout and labeling.

Description

Use FieldContent and FieldDescription for helper text.

By clicking this checkbox, you agree to the terms and conditions.

Disabled

Use the disabled prop to prevent interaction.

Group

Use multiple fields to create a checkbox list.

Show these items on the desktop:

Select the items you want to show on the desktop.

Table

NameEmailRole
Sarah Chensarah.chen@example.comAdmin
Marcus Rodriguezmarcus.rodriguez@example.comUser
Priya Patelpriya.patel@example.comUser
David Kimdavid.kim@example.comEditor

By clicking this checkbox, you agree to the terms and conditions.

You can manage your mobile notifications in the mobile settings page.

Checkbox Group

Value: [ "recents", "home", "applications", ]

Sidebar

Select the items you want to display in the sidebar.

Anatomy

Import all parts and piece them together.

use leptos::prelude::*;

#[component]
pub fn CheckboxAnatomy() -> impl IntoView {
    view! {
        <CheckboxGroup>
            <Checkbox />
        </CheckboxGroup>
    }
}

API Reference

Checkbox

A control that allows the user to toggle between checked and not checked.

Custom Attributes
NameTypeDefaultDescription
checkedboolfalse

A reactive signal coupled to the checkbox's checked value.

Implements global, input, and checkbox attributes.

CheckboxGroup

Contains all the parts of a checkbox group.

Custom Attributes
NameTypeDefaultDescription
invalidboolfalse

A reactive signal that toggles whether all the children Checkboxes appear invalid or not.

valueVec<String>[]

A dynamic list of all the values of checked children Checkboxes.

Implements global and fieldset attributes.