The checkbox component allows users to select one or more options from a set of choices. It's a fundamental form control that provides clear visual feedback for user selections and supports various states including checked, unchecked, indeterminate, and disabled. The component is designed with accessibility in mind, supporting keyboard navigation, screen readers, and proper form integration.
When to Use
✅ Use checkboxes when:
Users need to select multiple options from a list
Turning features or settings on/off independently
Accepting terms, conditions, or agreements
Building forms with optional or required selections
Creating filter interfaces with multiple criteria
Allowing bulk selection operations
❌ Don't use checkboxes for:
Single-choice selection (use radio buttons instead)
Displaying status without user interaction (use status indicators)
Design system docsExamplesBasic Usage
Simple checkboxes for individual selections with clear labels:
<dap-ds-stackdirection="column"><dap-ds-checkboxvalue="option-1"label="Enable notifications"></dap-ds-checkbox><dap-ds-checkboxvalue="option-2"label="Subscribe to newsletter"checked></dap-ds-checkbox><dap-ds-checkboxvalue="option-3"label="Remember my preferences"></dap-ds-checkbox></dap-ds-stack>
Sizes & Scaling
Choose checkbox sizes based on your layout density and visual hierarchy:
<><dap-ds-stackdirection="column"><div><dap-ds-typographyvariant="h4">Size variations</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxvalue="xs-option"label="Extra small checkbox"description="Compact size for dense layouts"size="xs"></dap-ds-checkbox><dap-ds-checkboxvalue="sm-option"label="Small checkbox (default)"description="Standard size for most use cases"size="sm"></dap-ds-checkbox><dap-ds-checkboxvalue="md-option"label="Medium checkbox"description="Larger size for better accessibility"size="md"></dap-ds-checkbox><dap-ds-checkboxvalue="lg-option"label="Large checkbox"description="Prominent size for important selections"size="lg"></dap-ds-checkbox></dap-ds-stack></div></dap-ds-stack></>
States & Feedback
Checkboxes support various states to communicate different conditions to users:
<><dap-ds-stackdirection="column"><div><dap-ds-typographyvariant="h4">Interactive states</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Default unchecked"value="state-1"></dap-ds-checkbox><dap-ds-checkboxlabel="Checked state"value="state-2"checked></dap-ds-checkbox><dap-ds-checkboxlabel="Indeterminate state"value="state-3"indeterminate></dap-ds-checkbox><dap-ds-checkboxlabel="Disabled unchecked"value="state-4"disabled></dap-ds-checkbox><dap-ds-checkboxlabel="Disabled checked"value="state-5"checkeddisabled></dap-ds-checkbox></dap-ds-stack></div><div><dap-ds-typographyvariant="h4">Validation states</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Required checkbox"value="validation-1"requiredinvalidfeedback="This field is required"feedbackType="negative"></dap-ds-checkbox><dap-ds-checkboxlabel="Valid selection"value="validation-2"checkedfeedback="Great choice!"feedbackType="positive"></dap-ds-checkbox><dap-ds-checkboxlabel="Warning example"value="validation-3"checkedfeedback="This action cannot be undone"feedbackType="warning"></dap-ds-checkbox></dap-ds-stack></div></dap-ds-stack></>
Label Positioning & Descriptions
Flexible label and description placement for different layout needs:
<><dap-ds-stackdirection="column"><div><dap-ds-typographyvariant="h4">Label positioning</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Label on the right (default)"value="pos-1"description="Description appears below the label"></dap-ds-checkbox><dap-ds-checkboxlabel="Label on the left"value="pos-2"description="Description still follows the label"labelPlacement="left"></dap-ds-checkbox></dap-ds-stack></div><div><dap-ds-typographyvariant="h4">Description placement</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Description below"value="desc-1"description="This description appears below the label"descriptionPlacement="bottom"></dap-ds-checkbox><dap-ds-checkboxlabel="Description above"value="desc-2"description="This description appears above the label"descriptionPlacement="top"></dap-ds-checkbox></dap-ds-stack></div></dap-ds-stack></>
Checkbox Groups
Use input groups to organize related checkboxes with shared labels and validation:
<><dap-ds-stackdirection="column"><div><dap-ds-typographyvariant="h4">Settings preferences</dap-ds-typography><dap-ds-input-grouprequiredlabel="Notification Settings"description="Choose which notifications you'd like to receive"tooltip="These settings control email and push notifications"tooltipAriaLabel="Information about notification settings"><dap-ds-checkboxlabel="Email notifications"description="Receive updates via email"value="email-notifications"></dap-ds-checkbox><dap-ds-checkboxlabel="Push notifications"description="Receive browser push notifications"value="push-notifications"checked></dap-ds-checkbox><dap-ds-checkboxlabel="SMS notifications"description="Receive text message alerts"value="sms-notifications"></dap-ds-checkbox></dap-ds-input-group></div><div><dap-ds-typographyvariant="h4">Form validation example</dap-ds-typography><dap-ds-input-grouprequiredlabel="Terms and Conditions"description="Please review and accept the following"feedbackType="negative"feedback="You must accept all terms to continue"><dap-ds-checkboxlabel="I accept the Terms of Service"value="terms-service"invalidrequired></dap-ds-checkbox><dap-ds-checkboxlabel="I accept the Privacy Policy"value="privacy-policy"checkedrequired></dap-ds-checkbox><dap-ds-checkboxlabel="I want to receive marketing communications"value="marketing-consent"description="Optional - you can change this later in settings"></dap-ds-checkbox></dap-ds-input-group></div></dap-ds-stack></>
Background & Border Variants
Special styling options for use on colored backgrounds or specific visual emphasis:
<><divstyle={{ backgroundColor:"#e9edf2", padding:"16px", borderRadius:"8px"}}><dap-ds-stackdirection="column"><dap-ds-typographyvariant="h4">Background variant</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Background style checkbox"description="Better visibility on colored backgrounds"value="bg-1"type="background"></dap-ds-checkbox><dap-ds-checkboxlabel="Background with border"description="Enhanced definition with border"value="bg-2"type="background"borderchecked></dap-ds-checkbox><dap-ds-checkboxlabel="Regular checkbox on background"description="Standard styling for comparison"value="bg-3"></dap-ds-checkbox></dap-ds-stack></dap-ds-stack></div><divstyle={{ backgroundColor:"white", padding:"16px", border:"1px solid #e0e0e0", borderRadius:"8px", marginTop:"16px"}}><dap-ds-stackdirection="column"><dap-ds-typographyvariant="h4">Border emphasis</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Bordered checkbox"description="Added border for visual emphasis"value="border-1"border></dap-ds-checkbox><dap-ds-checkboxlabel="Bordered and checked"description="Border with checked state"value="border-2"borderchecked></dap-ds-checkbox></dap-ds-stack></dap-ds-stack></div></>
Real-World PatternsUser Preferences Form
<divstyle={{border:'var(--dds-border-width-base) solid var(--dds-border-neutral-subtle)', padding:'var(--dds-spacing-600)', borderRadius:'var(--dds-radius-base)'}}><dap-ds-stack><dap-ds-typographyvariant="h3">Account Preferences</dap-ds-typography><dap-ds-input-grouplabel="Privacy Settings"description="Control how your information is used and shared"><dap-ds-checkboxlabel="Make my profile public"description="Other users can view your profile information"value="public-profile"></dap-ds-checkbox><dap-ds-checkboxlabel="Allow search engines to index my profile"description="Your profile may appear in search results"value="search-indexing"></dap-ds-checkbox><dap-ds-checkboxlabel="Share activity data for analytics"description="Help us improve the service (anonymous data only)"value="analytics-sharing"checked></dap-ds-checkbox></dap-ds-input-group><dap-ds-input-grouplabel="Communication Preferences"description="Choose how and when we contact you"><dap-ds-checkboxlabel="Product updates and announcements"description="Important news about new features and changes"value="product-updates"checked></dap-ds-checkbox><dap-ds-checkboxlabel="Weekly digest email"description="Summary of your activity and recommendations"value="weekly-digest"></dap-ds-checkbox><dap-ds-checkboxlabel="Marketing and promotional content"description="Special offers, tips, and educational content"value="marketing-content"></dap-ds-checkbox></dap-ds-input-group><dap-ds-stackdirection="row"><dap-ds-button>Save Preferences</dap-ds-button><dap-ds-buttonvariant="outline">Cancel</dap-ds-button></dap-ds-stack></dap-ds-stack></div>
Shopping Cart Features
<divstyle={{border:'var(--dds-border-width-base) solid var(--dds-border-neutral-subtle)', padding:'var(--dds-spacing-600)', borderRadius:'var(--dds-radius-base)'}}><dap-ds-stack><dap-ds-typographyvariant="h3">Order Options</dap-ds-typography><dap-ds-stackdirection="column"><dap-ds-checkboxlabel="Gift wrapping"description="Add special gift wrapping (+$5.99)"value="gift-wrapping"></dap-ds-checkbox><dap-ds-checkboxlabel="Express shipping"description="Delivery within 24 hours (+$12.99)"value="express-shipping"></dap-ds-checkbox><dap-ds-checkboxlabel="Insurance coverage"description="Protect your order against damage or loss (+$3.99)"value="insurance"checked></dap-ds-checkbox><dap-ds-checkboxlabel="SMS delivery updates"description="Receive text messages about your delivery status"value="sms-updates"></dap-ds-checkbox></dap-ds-stack><divstyle={{borderTop:'var(--dds-border-width-base) solid var(--dds-border-neutral-subtle)', paddingTop:'var(--dds-spacing-400)', marginTop:'var(--dds-spacing-400)'}}><dap-ds-stackdirection="row"justify="space-between"align="center"><dap-ds-typographyvariant="body"bold>Total: $127.97</dap-ds-typography><dap-ds-button>Proceed to Checkout</dap-ds-button></dap-ds-stack></div></dap-ds-stack></div>
Multi-step Form with Validation
<divstyle={{border:'var(--dds-border-width-base) solid var(--dds-border-neutral-subtle)', padding:'var(--dds-spacing-600)', borderRadius:'var(--dds-radius-base)'}}><dap-ds-stack><dap-ds-typographyvariant="h3">Account Setup - Step 2 of 3</dap-ds-typography><dap-ds-input-grouprequiredlabel="Required Agreements"description="Please review and accept the following to continue"feedbackType="negative"feedback="You must accept all required terms to proceed"><dap-ds-checkboxlabel="Terms of Service"description="I have read and accept the Terms of Service"value="terms-service"requiredinvalid></dap-ds-checkbox><dap-ds-checkboxlabel="Privacy Policy"description="I understand how my data will be processed"value="privacy-policy"requiredchecked></dap-ds-checkbox><dap-ds-checkboxlabel="Age Verification"description="I confirm that I am at least 18 years old"value="age-verification"requiredchecked></dap-ds-checkbox></dap-ds-input-group><dap-ds-input-grouplabel="Optional Preferences"description="These can be changed later in your account settings"><dap-ds-checkboxlabel="Email notifications"description="Receive important updates via email"value="email-notifications"checked></dap-ds-checkbox><dap-ds-checkboxlabel="Newsletter subscription"description="Get weekly tips and product updates"value="newsletter"></dap-ds-checkbox></dap-ds-input-group><dap-ds-stackdirection="row"justify="space-between"><dap-ds-buttonvariant="outline">Previous Step</dap-ds-button><dap-ds-buttondisabled>Continue</dap-ds-button></dap-ds-stack></dap-ds-stack></div>
Accessibility & Keyboard Navigation
The checkbox component is designed with accessibility as a core principle:
Keyboard Support
Space: Toggle checkbox state
Enter: Alternative toggle (custom enhancement)
Tab: Navigate between checkboxes
Shift + Tab: Navigate backwards
Screen Reader Support
Proper ARIA labels and descriptions
State announcements (checked, unchecked, indeterminate)
Form association and validation messages
Group labeling for related checkboxes
Focus Management
Clear focus indicators
Logical tab order
Programmatic focus control
<dap-ds-stackdirection="column"><dap-ds-typographyvariant="h4">Accessibility Examples</dap-ds-typography><dap-ds-checkboxlabel="Accessible checkbox"description="Try navigating with Tab and toggling with Space"value="accessible-1"></dap-ds-checkbox><dap-ds-checkboxlabel="Indeterminate with screen reader support"description="Screen readers announce this as 'mixed' state"value="accessible-2"indeterminate></dap-ds-checkbox><dap-ds-checkboxlabel="Required field with validation"description="Screen readers announce validation messages"value="accessible-3"requiredinvalidfeedback="This field is required for form submission"feedbackType="negative"></dap-ds-checkbox></dap-ds-stack>
Best PracticesForm Integration
Always provide clear, descriptive labels
Use descriptions for additional context
Group related checkboxes with dap-ds-input-group
Implement proper validation feedback
Consider the indeterminate state for parent-child relationships
Visual Design
Maintain consistent sizing within forms
Use background variants on colored surfaces
Consider border emphasis for important selections
Provide sufficient color contrast
Test with different themes and accessibility settings
User Experience
Use progressive disclosure for complex option sets
You can style CSS parts using the ::part() pseudo-element selector:
/* Target a specific part */.my-custom-dap-ds-checkbox::part(base){/* Your custom styles */}/* Target multiple parts */.my-custom-dap-ds-checkbox::part(base),.my-custom-dap-ds-checkbox::part(label){/* Shared styles */}