Single Checkbox
Standalone checkbox with label and optional description
Checkbox Group
Multiple checkboxes with shared validation using min/max selection constraints
Built-in Features
What you get out of the box with zero configuration
Auto-initializes with the forms system. Two-way binding syncs disabled and required states between inputs and containers.
Set via NDS.Forms.setIndeterminate(). Auto-clears on user click. Fires nds:indeterminateChange event with detail.indeterminate boolean.
Min/max constraints with data-min-checked and data-max-checked. Auto-revalidates on change once an error is shown. Call NDS.Forms.clearStatus() to reset.
Column layout by default, row layout with nds-rowView class. Gaps adjust on mobile for touch-friendly spacing.
Usage Guidelines
When and how to use checkboxes effectively
When to Use
- Multiple selections from a list of options
- Binary choices like accepting terms or toggling a setting
- Use radio buttons when only one selection is allowed
- Use switches for instant on/off actions without form submission
- Keep groups to 7 or fewer options. For longer lists, consider a multi-select dropdown
- Use indeterminate state for "select all" parent checkboxes that partially control child selections
JavaScript API
Data Attributes
| Attribute | Element | Description |
|---|---|---|
data-state~="indeterminate" | .nds-form-container | Stamped by NDS.Forms.setIndeterminate() when the checkbox is indeterminate; removed when cleared |
data-state~="disabled" | .nds-form-container, .nds-check-group | Propagates disabled styling to all child inputs |
data-state~="readonly" | .nds-form-container | Renders the checkbox tile as read-only: border only, no fill |
data-required | .nds-form-container, .nds-check-group | Marks a single checkbox or group as required on form submit |
data-min-checked | .nds-check-group | Minimum number of checkboxes that must be selected |
data-max-checked | .nds-check-group | Maximum number of checkboxes that may be selected |
data-error-message | .nds-check-group | Overrides the default validation error message shown below the group |
CSS Custom Properties
| Property | Default | Description |
|---|---|---|
--checkbox-tile-bg | --background-default | Fill color of the checkbox tile. Override inline to tint a single checkbox |
--checkbox-tile-border | --controls-border | Box-shadow ring color around the tile |
--checkbox-glyph-bg | --background-default | Color of the checkmark or dash glyph painted inside the tile |
--nds-input-size | 16px | Size of the checkbox control. Set by size modifiers: nds-md = 20px, nds-lg = 24px. Override inline for a custom size |
Validation Attributes
- Add
data-requiredto a single checkbox container to make it mandatory before form submission - Add
data-requiredto a group to require at least one selection - Use
data-min-checked="2"on a group to enforce a minimum number of selections - Use
data-max-checked="4"on a group to cap the maximum number of selections - Combine both for a range constraint (e.g. "select 2 to 4 options")
- Add
data-error-messageon the group to override the default validation message - Place a
nds-form-footerwithdata-feedback-targetinside the group for dynamic feedback placement