Utilities
Sizing
Style properties for controlling the size of an element.
Width
Use the width or w property to set the width of an element.
<div className={css({ width: '5' })} />
<div className={css({ w: '5' })} /> // shorthandFractional width
Use can set fractional widths using the width or w property.
Values can be within the following ranges:
- Thirds:
1/3to2/3 - Fourths:
1/4to3/4 - Fifths:
1/5to4/5 - Sixths:
1/6to5/6 - Twelfths:
1/12to11/12
<div className={css({ width: '1/2' })} />
<div className={css({ w: '1/2' })} /> // shorthand
<div className={css({ width: '1/3' })} />
<div className={css({ w: '1/3' })} /> // shorthandMax width
Use the maxWidth or maxW property to set the maximum width of an element.
<div className={css({ maxWidth: '5' })} />
<div className={css({ maxW: '5' })} /> // shorthandMin width
Use the minWidth or minW property to set the minimum width of an element.
<div className={css({ minWidth: '5' })} />
<div className={css({ minW: '5' })} /> // shorthand| Prop | CSS Property | Token Category |
|---|---|---|
w, width | width | sizes |
maxW, maxWidth | max-width | sizes |
minW, minWidth | min-width | sizes |
Height
Use the height or h property to set the height of an element.
<div className={css({ height: '5' })} />
<div className={css({ h: '5' })} /> // shorthandFractional height
Use can set fractional heights using the height or h property.
Values can be within the following ranges:
- Thirds:
1/3to2/3 - Fourths:
1/4to3/4 - Fifths:
1/5to4/5 - Sixths:
1/6to5/6
<div className={css({ height: '1/2' })} />
<div className={css({ h: '1/2' })} /> // shorthandRelative heights
You can use the modern relative height values dvh, svh, lvh.
<div className={css({ height: 'dvh' })} />
<div className={css({ h: 'dvh' })} /> // shorthandMax height
Use the maxHeight or maxH property to set the maximum height of an element.
<div className={css({ maxHeight: '5' })} />
<div className={css({ maxH: '5' })} /> // shorthandMin height
Use the minHeight or minH property to set the minimum height of an element.
<div className={css({ minHeight: '5' })} />
<div className={css({ minH: '5' })} /> // shorthand| Prop | CSS Property | Token Category |
|---|---|---|
h, height | height | sizes |
maxH, maxHeight | max-height | sizes |
minH, minHeight | min-height | sizes |
Size
Use the boxSize property to set the width and height of an element.
<div className={css({ boxSize: '24' })} />| Prop | CSS Property | Token Category |
|---|---|---|
boxSize | width, height | sizes |