--- templateEngineOverride: njk layout: layouts/page.njk title: Checkbox description: A control that allows the user to toggle between checked and not checked. toc: - label: Usage id: usage - label: Checked state id: checked-state - label: Invalid state id: invalid-state - label: Examples id: examples children: - label: Basic id: example-basic - label: Description id: example-description - label: Disabled id: example-disabled - label: Group id: example-group - label: Table id: example-table - label: RTL id: example-rtl --- {% from "macros/code_preview.njk" import code_preview %} {% from "macros/code_block.njk" import code_block %} {% set code %}
Add the input class to your <input type="checkbox"> elements. Pair it with Field and a native <label> for proper layout and labeling.
Use native HTML attributes for state. Add checked for an initially checked checkbox, or read and update the element's checked property in JavaScript.
Set aria-invalid="true" on the checkbox and, when using field, set data-invalid="true" on the field wrapper.
You must accept the terms to continue.
By clicking this checkbox, you agree to the terms and conditions.
| Status | ||
|---|---|---|
| Active | olivia@example.com | |
| Inactive | noah@example.com |
Checkbox layout uses document direction and logical spacing. Set dir="rtl" on a parent to render right-to-left.
يمكنك تغيير هذا الخيار في أي وقت.