bcgov / design-system

The B.C. Design System helps public sector design and development teams build consistent, accessible products
https://gov.bc.ca/designsystem
Apache License 2.0
56 stars 38 forks source link

Add Checkbox and CheckboxGroup components #463

Closed mkernohanbc closed 2 weeks ago

mkernohanbc commented 1 month ago

This PR adds two new components, and their supporting documentation:

They are based on RAC Checkbox and CheckboxGroup.

Checkbox renders a focusable/selectable <div> and a hidden <input>. The text label is set via the children slot:

Screenshot 2024-08-20 at 15 33 00

Checkbox supports the following states:

Note: Checkbox can be used independently of a CheckboxGroup, but using it as a standalone component requires additional work to add validation and error handling that CheckboxGroup has built-in.

CheckboxGroup provides a semantic wrapper for one or more checkboxes:

Screenshot 2024-08-20 at 15 35 53

It includes these slots:

Additionally, the orientation prop can be used to toggle the layout of a group between vertical (default) and horizontal.

ty2k commented 2 weeks ago

I've made changes to the Checkbox and CheckboxGroup to bring in our latest changes, update the styles to match our most up to date design, and add tests. With these changes, I think we're ready to merge. Will mark this as approved and leave it up to you to confirm, @mkernohanbc.

isIndeterminate + isDisabled:

Screenshot 2024-09-11 at 8 53 34 AM

isIndeterminate + isInvalid:

Screenshot 2024-09-11 at 8 57 36 AM

flexWrap defaulted to nowrap:

Screenshot 2024-09-11 at 9 17 34 AM

flexWrap set to wrap:

Screenshot 2024-09-11 at 9 17 15 AM
mkernohanbc commented 2 weeks ago

Thanks for all your work to clean this up @ty2k — looks good to me! Will squash and merge now.