-
Notifications
You must be signed in to change notification settings - Fork 1k
USWDS - Button Group: Improve appearance of buttons with wrapping text #5657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Stretch all button group items above mobile-lg breakpoint. - Allow buttons to take full height. - Add default variant example

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! I noticed a visual bug with anchor elements we should address. This should be good to go after that 👍

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Button group maintains equal heights at various sizes
- Button group looks appropriate when one button has larger text content
- Previous inconsistencies are resolved
- No visual regressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good. The usa-button
elements inside the button group appear to be the same height regardless of their content, and the content is vertically centered.
Important
My only note is that I'd like to mark this as a potentially breaking change since the default button group will no longer wrap at "desktop" widths. I think it would be helpful to warn users to check their implementations.
Tests
After pulling in jm-enhancement-button-icons
from #5398, I confirmed the following in Chrome, Safari, and Firefox:
- Confirm that all elements in a button group are the same height regardless of content height
- Confirm that text is vertically centered inside the
usa-button
elements (in both regular and button group)- Mobile view
- Desktop view
- Confirm that icons are vertically centered inside button group elements
- Confirm that
nowrap
will not cause any unexpected breaks - Confirm that this works with both links and buttons
Screenshots
Mobile view
Desktop view
With icons
I also tested this with icons (to confirm compatibility with #5398) and it worked as expected:
Important
This work is strictly to match button height in button-group. Changes in #5398 address the text alignment issue noted in #5657 (review).
Summary
Improved the appearance of button groups when button text wraps to multiple lines. Now, every button in the group will be the same height.
Extending work from #5324. Thanks @aduth!
Breaking change
This is not a breaking change.
Flex-wrap was explicitly added on
mobile-lg
, but it follows the current behavior of stacking on mobile and grouping abovemobile-lg
.Additional information
With this implementation the button does not wrap on desktop sizes.
Before

After

As noted by @amyleadem in #5657 (review).
Related issue
N/A for this issue. Semi-related #5398.
Related pull requests
Extension of #5324.
Changelog PR: uswds/uswds-site#2498.
Preview link
Preview link: Button group text wrap preview →
Problem statement
Summarize the problem this PR solves in a clear and concise statement.
Solution
Above
mobile-lg
breakpoint button groups will:Testing and review