Utilities

Height and width

Set the dimensions of an item.

CSS properties

height max-height max-width min-height min-width width

Examples and usage

Utilities, values, and variants may be activated and deactivated in advanced settings.

Height

CSS property: height

  • responsive
  • active
  • hover
  • focus
  • visited
.height-auto
auto
.height-0
0
.height-1px
1px
.height-2px
2px
.height-05
4px
.height-1
8px
.height-105
12px
.height-2
16px
.height-205
20px
.height-3
24px
.height-4
32px
.height-5
40px
.height-6
48px
.height-7
56px
.height-8
64px
.height-9
72px
.height-10
80px
.height-15
120px
.height-card
160px
.height-card-lg
240px
.height-mobile
320px
.height-full
100%
.height-viewport
100vh

Width

CSS property: width

  • responsive
  • active
  • hover
  • focus
  • visited
.width-auto
auto
.width-0
0
.width-1px
1px
.width-2px
2px
.width-05
4px
.width-1
8px
.width-105
12px
.width-2
16px
.width-205
20px
.width-3
24px
.width-4
32px
.width-5
40px
.width-6
48px
.width-7
56px
.width-8
64px
.width-9
72px
.width-10
80px
.width-15
120px
.width-card
160px
.width-card-lg
240px
.width-mobile
320px
.width-mobile-lg
480px
.width-tablet
640px
.width-tablet-lg
880px
.width-desktop
1024px
.width-desktop-lg
1200px
.width-widescreen
1400px
.width-full
100%

Maximum height

CSS property: max-height

  • responsive
  • active
  • hover
  • focus
  • visited

.maxh-none none

.maxh-05 4px

.maxh-1 8px

.maxh-105 12px

.maxh-2 16px

.maxh-205 20px

.maxh-3 24px

.maxh-4 32px

.maxh-5 40px

.maxh-6 48px

.maxh-7 56px

.maxh-8 64px

.maxh-9 72px

.maxh-10 80px

.maxh-15 120px

.maxh-card 160px

.maxh-card-lg 240px

.maxh-mobile 320px

.maxh-mobile-lg 480px

.maxh-tablet 640px

.maxh-tablet-lg 880px

.maxh-viewport 100vh

Maximum width

CSS property: max-width

  • responsive
  • active
  • hover
  • focus
  • visited

.maxw-none none

.maxw-05 4px

.maxw-1 8px

.maxw-105 12px

.maxw-2 16px

.maxw-205 20px

.maxw-3 24px

.maxw-4 32px

.maxw-5 40px

.maxw-6 48px

.maxw-7 56px

.maxw-8 64px

.maxw-9 72px

.maxw-10 80px

.maxw-15 120px

.maxw-card 160px

.maxw-card-lg 240px

.maxw-mobile 320px

.maxw-mobile-lg 480px

.maxw-tablet 640px

.maxw-tablet-lg 880px

.maxw-desktop 1024px

.maxw-desktop-lg 1200px

.maxw-widescreen 1400px

.maxw-full 100%

Minimum height

CSS property: min-height

  • responsive
  • active
  • hover
  • focus
  • visited

.minh-none none

.minh-0 0

.minh-05 4px

.minh-1 8px

.minh-105 12px

.minh-2 16px

.minh-205 20px

.minh-3 24px

.minh-4 32px

.minh-5 40px

.minh-6 48px

.minh-7 56px

.minh-8 64px

.minh-9 72px

.minh-10 80px

.minh-15 120px

.minh-card 160px

.minh-card-lg 240px

.minh-mobile 320px

.minh-mobile-lg 480px

.minh-tablet 640px

.minh-tablet-lg 880px

.minh-full 100%

.minh-viewport 100vh

Minimum width

CSS property: min-width

  • responsive
  • active
  • hover
  • focus
  • visited

.minw-none none

.minw-05 4px

.minw-1 8px

.minw-105 12px

.minw-2 16px

.minw-205 20px

.minw-3 24px

.minw-4 32px

.minw-5 40px

.minw-6 48px

.minw-7 56px

.minw-8 64px

.minw-9 72px

.minw-10 80px

.minw-15 120px

Aspect ratio

  • responsive
  • active
  • hover
  • focus
  • visited
.add-aspect-9x16
.add-aspect-1x1
.add-aspect-4x3
.add-aspect-16x9
.add-aspect-2x1

Circle

  • responsive
  • active
  • hover
  • focus
  • visited
.circle-2px
2px
.circle-05
4px
.circle-1
8px
.circle-105
12px
.circle-2
16px
.circle-205
20px
.circle-3
24px
.circle-4
32px
.circle-5
40px
.circle-6
48px
.circle-7
56px
.circle-8
64px
.circle-9
72px
.circle-10
80px
.circle-15
120px
.circle-card
160px
.circle-card-lg
240px
.circle-mobile
320px

Square

  • responsive
  • active
  • hover
  • focus
  • visited
.square-2px
2px
.square-05
4px
.square-1
8px
.square-105
12px
.square-2
16px
.square-205
20px
.square-3
24px
.square-4
32px
.square-5
40px
.square-6
48px
.square-7
56px
.square-8
64px
.square-9
72px
.square-10
80px
.square-15
120px
.square-card
160px
.square-card-lg
240px
.square-mobile
320px

Utility mixins

Utilities may be used in component Sass with utility mixins. Highlighted tokens are the USWDS design tokens that serve as the foundation for all design system styles. Each token is also a documentation link. Consult the Design tokens section for more information on tokens and how to use them in USWDS.

Utility Mixin Example
.height-units u-height(units) @include u-height('card')
.width-units u-width(units) @include u-width('auto')
.maxh-units u-maxh(units) @include u-maxh('screen')
.maxw-units u-maxw(units) @include u-maxw('card-lg')
.minh-units u-minh(units) @include u-minh('screen')
.minw-units u-minw(units) @include u-minw('auto')
.add-aspect-ratio add-aspect(ratio) @include add-aspect('16x9')
.circle-units u-circle(units) @include u-circle('05')
.square-units u-square(units) @include u-square('05')

Using utility mixins

  • Use single-quoted strings in utility mixins. Do not quote numbers or px values, with the exception of half (05) values like '05', '105', and '205' which should be treated as strings.
  • String tokens for half values (05) and negative values (like neg-1)may also be written with their unquoted number token equivalent: 0.5, 1.5, 2.5, 2.5, -1, -1.5, etc
  • If multiple utilities share the same prefix (ex: .text- or .flex-) or a single utility accepts multiple kinds of values (ex: .border accepts both border weight and border color), their shared mixin can accept multiple comma-separated values: u-text('primary-darkest', 'no-underline', 'bold') or u-border-top(2px, 'accent-warm').
  • Output any utility mixin as !important by appending !important to the mixin’s argument list: u-bg('red-warm-50v', !important).

Advanced settings

Responsive variants

Add a responsive breakpoint prefix separated with a : to target a utility at a responsive breakpoint and higher, following a mobile-first methodology.

Set which breakpoints are available to USWDS utilities with the $theme_output_breakpoints variable found in _uswds-theme-utilities.scss.

Breakpoint name Width Default
card 160px false
card-lg 240px false
mobile 320px false
mobile-lg 480px true
tablet 640px true
tablet-lg 880px false
desktop 1024px true
desktop-lg 1200px false
widescreen 1400px false

Set whether a utility family outputs with responsive variants by setting the value of $[utility_family]-settings.responsive in _uswds-theme-utilities.scss.

Utility variable Default
$height-settings.responsive false
$width-settings.responsive false
$max-height-settings.responsive false
$max-width-settings.responsive false
$min-height-settings.responsive false
$min-width-settings.responsive false
$add-aspect-settings.responsive false
$circle-settings.responsive false
$square-settings.responsive false

State variants

Use a state prefix separated with a : to target a utility in a specific state.

Set whether a utility outputs a specific state variant by setting the value of the $[utility_family]-settings.[state] variable in _uswds-theme-utilities.scss.

Utility variable active focus hover visited
$height-settings false false false false
$width-settings false false false false
$max-height-settings false false false false
$max-width-settings false false false false
$min-height-settings false false false false
$min-width-settings false false false false
$add-aspect-settings false false false false
$circle-settings false false false false
$square-settings false false false false

Output control

Control whether or not to output any USWDS utility family by setting the value of the $[utility_family]-settings.output variable found in _uswds-theme-utilities.scss.

A value of true will output the utility family and any variants. A value of false prevents the output of the family and any variants.

Utility variable Default
$height-settings.output true
$width-settings.output true
$max-height-settings.output true
$max-width-settings.output true
$min-height-settings.output true
$min-width-settings.output true
$add-aspect-settings.output true
$circle-settings.output true
$square-settings.output true

Custom values

By default, USWDS utilities output the standard values listed in the documentation above. Customize and refine any utility family’s specific values by editing the $[utility_family]-manual-values and $[utility_family]-palettes variables in _uswds-theme-utilities.scss.

Manual values

Specify manual values as unique key:value pairs using the $[utility_family]-manual-values map, where the key is the utility’s value suffix, and the value is what the utility will output.

Palettes

Palettes are predefined groups of values. Add palettes to the $[utility_family]-palettes list variable in _uswds-theme-utilities.scss to add those values to the utility family.

Default palettes

Palette name Palette contents
'palette-height-default' height default tokens
'palette-width-default' width default tokens
'palette-max-height-default' max-height default tokens
'palette-max-width-default' max-width default tokens
'palette-min-height-default' min-height default tokens
'palette-min-width-default' min-width default tokens
'palette-add-aspect-default' add-aspect default tokens
'palette-circle-default' circle default tokens
'palette-square-default' square default tokens

Spacing and units

Palette name Palette contents
'palette-units' All spacing unit tokens (system, ch, em, percentage)
'palette-units-system' All system spacing unit tokens
'palette-units-system-breakpoints' All named spacing unit tokens: card, card-lg, mobile, mobile-lg, tablet, tablet-lg, desktop, desktop-lg, widescreen
'palette-units-system-positive' All positive spacing unit tokens
'palette-units-system-positive-smaller' 1px, 2px
'palette-units-system-positive-small' 05, 1, 105, 2, 205, 3
'palette-units-system-positive-medium' 4, 5, 6, 7, 8, 9, 10, 15
'palette-units-system-positive-large' card, card-lg, mobile
'palette-units-system-positive-larger' mobile-lg, tablet, tablet-lg
'palette-units-system-positive-largest' desktop, desktop-lg, widescreen
'palette-units-system-negative' All negative spacing values
'palette-units-system-negative-smaller' neg-1px, neg-2px
'palette-units-system-negative-small' neg-05, neg-1, neg-105, neg-2, neg-205, neg-3
'palette-units-ch' 05ch, 1ch, 105ch, 2ch, 3ch, 4ch, 5ch, neg-05ch, neg-1ch, neg-105ch, neg-2ch, neg-3ch, neg-4ch, neg-5ch
'palette-units-ch-positive' 05ch, 1ch, 105ch, 2ch, 3ch, 4ch, 5ch
'palette-units-ch-negative' neg-05ch, neg-1ch, neg-105ch, neg-2ch, neg-3ch, neg-4ch, neg-5ch
'palette-units-em' 05em, 1em, 105em, 2em, 3em, 4em, 5em, 6em, 7em, 8em, 9em, 10em
'palette-units-percentage' 10ct, 20ct, 25ct, 30ct, 33ct, 40ct, 50ct, 60ct, 66ct, 75ct, 80ct, 90ct, 100ct
'palette-units-0' 0