Skip to content

Commit 03082ea

Browse files
author
James Mejia
committed
Use flexbox for button alignment
Includes new setting $theme-button-column-gap, which takes units for the inner spacing.
1 parent 3c3684e commit 03082ea

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/usa-button/src/styles/_usa-button.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ $button-stroke: inset 0 0 0 units($theme-button-stroke-width);
1111
@include typeset($theme-button-font-family, null, 1);
1212
@include set-text-and-bg("primary", $context: $button-context);
1313
appearance: none;
14+
align-items: center;
1415
border: 0;
1516
border-radius: radius($theme-button-border-radius);
1617
cursor: pointer;
17-
display: inline-block;
18+
column-gap: units($theme-button-column-gap);
19+
display: inline-flex;
1820
font-weight: font-weight("bold");
1921
margin-right: units(1);
2022
padding: units(1.5) units(2.5);
@@ -52,11 +54,8 @@ $button-stroke: inset 0 0 0 units($theme-button-stroke-width);
5254
@include button-disabled;
5355
}
5456

55-
// @TODO: Use `:has()` selector once browser support improves.
56-
// https://developer.mozilla.org/en-US/docs/Web/CSS/:has#browser_compatibility
5757
.usa-icon {
58-
margin-top: -0.1em; // Similar pattern to _usa-breadcrumb.scss:14.
59-
vertical-align: middle;
58+
flex-shrink: 0; // Avoid shrinking on small screens.
6059
}
6160

6261
@media (forced-colors: active) {

packages/uswds-core/src/styles/settings/_settings-components.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ $theme-breadcrumb-separator-color: "base" !default;
5555
// Button
5656
$theme-button-font-family: "ui" !default;
5757
$theme-button-border-radius: "md" !default;
58+
$theme-button-column-gap: 1 !default;
5859
$theme-button-small-width: 6 !default;
5960
$theme-button-stroke-width: 2px !default;
6061

0 commit comments

Comments
 (0)