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
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