--- layout: layouts/component.njk title: Checkbox description: A control that allows the user to toggle between checked and not checked. toc: - label: Usage id: usage - label: Examples id: examples children: - label: Disabled id: example-disabled - label: With text id: example-with-text - label: Form id: example-form --- {% from "macros/code_preview.njk" import code_preview %} {% from "macros/code_block.njk" import code_block %} {% set code %}{% endset %} {{ code_preview("checkbox", code) }}

Usage

Simply add the input class to your <input type="radio"> elements or have a parent with the form class (read more about form). You can also set the aria-invalid attribute to true to make the input invalid.

{{ code_block(code) }}

Examples

Disabled

{% set code %}{% endset %} {{ code_preview("checkbox-disabled", code) }}

With text

{% set code %}

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

{% endset %} {{ code_preview("checkbox-with-text", code) }}

Form

{% set code %}

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

{% endset %} {{ code_preview("input-form", code) }} {% set code %}

Select the items you want to display in the sidebar.

{% endset %} {{ code_preview("input-form", code) }}