Skip to content

Sizing

Max-Width

Utilities for setting the maximum width of an element.

Quick reference

ClassDescription
max-w-nonemax-width: none
max-w-fullmax-width: 100%
max-w-minmax-width: min-content
max-w-maxmax-width: max-content
max-w-fitmax-width: fit-content
max-w-prosemax-width: 65ch
max-w-{size}max-width: {size}
max-w-{fraction}max-width: {fraction}
max-w-{breakpoint}max-width: {breakpoint} (Unsupported)

Available values
{size}: 0, 1, 2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 44, 48, 56, 64, 80, 96, 112, 128, 144
{fraction}: Any fraction is valid - e.g. 1/5
{breakpoint}: sm, md, lg

max-w-{breakpoint} not yet supported

This functionality is not yet supported! If you need this, reach out to us on #nmp-warp-design-system.

Basic usage

Setting the maximum width

Set the maximum width of an element using the max-w-{size} utilities.

AI generated picture of 1920s scientists working on a warp drive

AI generated picture of warp scientists from the 1920s

html
<div class="max-w-[300] ...">
  <!-- ... -->
</div>

Arbitrary values

If you need to use a one-off max-width value that doesn't make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

html
<div class="max-w-[50]">
  <!-- ... -->
</div>

Applying conditionally

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:max-w-lg to apply the max-w-lg utility at only medium screen sizes and above.

html
<div class="max-w-sm md:max-w-lg">
  <!-- ... -->
</div>

Released under the Apache 2.0 License.