All of the common API properties support using the responsive styles syntax
if breakpoints
are defined in the theme. Simply pass an array of values to the property
instead of a single value.
The first value in the array will be the base style. The second value in the array will
be applied at the smallest breakpoint and up. The third value will be applied at the second
smallest breakpoint and up, etc.
Using null
for one of the values in the array will cause the previous value to be applied
until the next breakpoint.
<Box
width={[ '100px', '200px' ]}
height={[ '50px', null, '100px' ]}
backgroundColor={[ 'Tertiary', null, null, 'Secondary' ]}
/>
Live Demo
All layout components share a common styling API as detailed below. These style props will accept
any appropriate CSS values - including units like vw
and vh
, and functions like calc()
,
rgba()
, hsl()
, etc.
If you're using a theme, many of these style props will have direct access to the design
tokens and scales in the theme. Refer to the tables below to see which style props have access to which theme
keys.
In addition to the style props detailed below, all layout components also have access to the props
mentioned in the advanced API section.
Component Prop | CSS Property | Theme Key |
---|
display | display | |
width | width | |
height | height | |
minWidth | min-width | |
minHeight | min-height | |
maxWidth | max-width | |
maxHeight | max-height | |
overflow | overflow | |
overflowX | overflow-x | |
overflowY | overflow-y | |
verticalAlign | vertical-align | |
transform | transform | |
transition | transition | |
Component Prop | CSS Property | Theme Key |
---|
flex | flex | |
flexWrap | flex-wrap | |
flexDirection | flex-direction | |
flexGrow | flex-grow | |
flexShrink | flex-shrink | |
flexBasis | flex-basis | |
alignItems | align-items | |
alignContent | align-content | |
justifyItems | justify-items | |
justifyContent | justify-content | |
alignSelf | align-self | |
justifySelf | justify-self | |
order | order | |
Component Prop | CSS Property | Theme Key |
---|
gridGap | grid-gap | |
gridColumnGap | grid-column-gap | |
gridRowGap | grid-row-gap | |
gridColumn | grid-column | |
gridRow | grid-row | |
gridAutoFlow | grid-auto-flow | |
gridAutoColumns | grid-auto-columns | |
gitAutoRows | grid-auto-rows | |
gridTemplate | grid-template | |
gridTemplateColumns | grid-template-columns | |
gridTemplateRows | grid-template-rows | |
gridTemplateAreas | grid-template-areas | |
gridArea | grid-area | |
Component Prop | CSS Property | Theme Key |
---|
position | position | |
top | top | |
bottom | bottom | |
left | left | |
right | right | |
zIndex | z-index | zIndices |
Component Prop | CSS Property | Theme Key |
---|
margin , m | margin | space |
marginTop , mt | margin-top | space |
marginBottom , mb | margin-bottom | space |
marginLeft , ml | margin-left | space |
marginRight , mr | margin-right | space |
marginX , mx | margin-left and margin-right | space |
marginY , my | margin-top and margin-bottom | space |
padding , p | padding | space |
paddingTop , pt | padding-top | space |
paddingBottom , pb | padding-bottom | space |
paddingLeft , pl | padding-left | space |
paddingRight , pr | padding-right | space |
paddingX , px | padding-left and padding-right | space |
paddingY , py | padding-top and padding-bottom | space |
Component Prop | CSS Property | Theme Key |
---|
color | color | colors |
backgroundColor , bg | background-color | colors |
borderColor | border-color | colors |
fill | fill | colors |
stroke | stroke | colors |
Component Prop | CSS Property | Theme Key |
---|
fontFamily | font-family | fonts |
fontSize | font-size | fontSizes |
fontWeight | font-weight | fontWeights |
lineHeight | line-height | lineHeights |
letterSpacing | letter-spacing | letterSpacings |
textAlign | text-align | |
textDecoration | text-decoration | |
textTransform | text-transform | |
fontStyle | font-style | |
Component Prop | CSS Property | Theme Key |
---|
border | border | |
borderWidth | border-width | borderWidths |
borderStyle | border-style | |
borderColor | border-color | colors |
borderRadius | border-radius | radii |
borderTop | border-top | |
borderTopWidth | border-top-width | borderWidths |
borderTopStyle | border-top-style | |
borderTopColor | border-top-color | colors |
borderBottom | border-bottom | |
borderBottomWidth | border-bottom-width | borderWidths |
borderBottomStyle | border-bottom-style | |
borderBottomColor | border-bottom-color | colors |
borderLeft | border-left | |
borderLeftWidth | border-left-width | borderWidths |
borderLeftStyle | border-left-style | |
borderLeftColor | border-left-color | colors |
borderRight | border-right | |
borderRightWidth | border-right-width | borderWidths |
borderRightStyle | border-right-style | |
borderRightColor | border-right-color | colors |
borderX | border-left and border-right | |
borderY | border-top and border-bottom | |
borderTopLeftRadius | border-top-left-radius | radii |
borderTopRightRadius | border-top-right-radius | radii |
borderBottomLeftRadius | border-bottom-left-radius | radii |
borderBottomRightRadius | border-bottom-right-radius | radii |
strokeWidth | stroke-width | |
Component Prop | CSS Property | Theme Key |
---|
backgroundImage | background-image | |
backgroundSize | background-size | |
backgroundPosition | background-position | |
backgroundRepeat | background-repeat | |
Component Prop | CSS Property | Theme Key |
---|
textShadow | text-shadow | shadows |
boxShadow | box-shadow | shadows |