USWDS - Utilities: Add theme setting for custom breakpoints#5985
USWDS - Utilities: Add theme setting for custom breakpoints#5985jamigibbs wants to merge 4 commits intouswds:developfrom
Conversation
|
👋 Hey @mejiaj, @mahoneycm, and @amyleadem! Just wanted to check in and see if there's been any progress towards merging this PR. Do ya'll have any updates you can provide? If there's anything else you need from our team, please let us know. Thanks! |
|
Hey there @micahchiang ! We're reviewing as a candidate for the Thanks for bumping! |
|
Hello @jamigibbs Thank you so much for submitting this work! The community will be a big fan of this addition 🎉 We plan on making a few structural tweaks to this work to nudge it closer to existing USWDS patterns and get this out as part of the Thanks again! |
|
Thanks for submitting this! Like @mahoneycm said, we're building on the work here in another PR. Closing in favor of #6048. |
Summary
Added a theme setting for including custom breakpoints to the utility classes.
Being able to add a custom breakpoint to the utilities is useful for integrating USWDS with existing frameworks or other design requirements. Custom breakpoints will generate with the default system breakpoints.
Breaking change
This is not a breaking change.
Related issue
Closes #5984
Problem statement
As a designer or developer on projects that have existing designs, I would like to be able to add existing breakpoints to the generated USWDS utilities. Currently, the only breakpoints generating with the utilities are those that are available in the internal system settings (which are understandably not modifiable).
The consequence of not being able to add custom breakpoints is the fracturing of site stylesheets causing additional maintenance as well as the possibility of needing to fork parts of the USWDS system in order to handle those custom breakpoints. Being able to programmatically add custom breakpoints also provides a safer approach versus hacking the
$system-propertiesdirectly.Solution
This PR will add a new theme setting
$theme-utility-breakpoints-customwhich is a map to pass additional breakpoint keys and values.This approach does not modify the default breakpoints. Instead, it simply integrates any custom breakpoints with those system properties in order to generate utility classes.
A possible gotcha is that it appears the setting will require that the key value be in
rembecause of theat-mediamixin. This could be mitigated by adding clear documentation for setting usage though.The new theme setting can be used alongside the existing breakpoint setting like this:
Which will generate additional utility breakpoint classes. For example:
Testing and review
I tested this locally with the VA design system CSS-Library utilities generator and inspecting the generated utility classes.