v14.2.0

Playroom

Github

Style Props

View Source

Standard system of props used throughout UI kit components to add or alter CSS styles.

Controlling styles through props

All primitive components accept the following props that will be converted into CSS using Emotion:

Typography

fontFamily, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, whiteSpace

fontSize: numeric values will be passed as an index to theme.fontSizes

Color

backgroundColor, borderColor, borderBottomColor, borderLeftColor, borderRightColor, borderTopColor, color, fill, stroke: accept any valid color as well as theme colors.

Layout

display, width, height, minWidth, minHeight, maxWidth, maxHeight, overflow, overflowX, overflowY

Position

position, top, right, bottom, left, zIndex

Spacing

padding, paddingTop, paddingRight, paddingBottom, paddingLeft

margin, marginTop, marginRight, marginBottom, marginLeft

marginVertical: maps to margin-top, and margin-bottom

marginHorizontal: maps to margin-left, and margin-right

paddingHorizontal: maps to padding-left, and padding-right

paddingVertical: maps to padding-top, and padding-bottom

Grid

column: maps to grid-column

columnStart: maps to grid-column-start

columnEnd: maps to grid-column-end

row: maps to grid-row

rowStart: maps to grid-row-start

rowEnd: maps to grid-row-end

Flexbox

basis: maps to flex-basis

grow: maps to flex-grow

shrink: maps to flex-shrink

wrap: when set to true, it sets flex-wrap: wrap

Miscellaneous

visible: accepts true or false. Maps to display property.

elevation: accepts 0-4, 0 being the closest and 4 being the furthest. Inspired by Material Design.

radius: maps to borderRadius

radiusTop: maps to borderTopLeftRadius and borderTopRightRadius

radiusRight: maps to borderTopRightRadius and borderBottomRightRadius

radiusBottom: maps to borderBottomLeftRadius and borderBottomRightRadius

radiusLeft: maps to borderBottomLeftRadius and borderTopLeftRadius

uppercase: sets textTransform: uppercase

CSS prop

In addition to the props above, UI kit components also accept a css prop that can be used to create any valid CSS object styles. This is primarly used for one-off cases when needing to set nuanced CSS styles.

CSS in JS

This library uses Emotion to power all style props and theming. Style props are inspired by jsxstyle and styled-system.

8-point grid

When passing a numeric value to lineHeight, layout, position, spacing, grid, or flexbox properties they will be multiplied by an internal spacing value of 8. Read more about 8-point grid and how it can help simplify UI development.

  • Controlling styles through props
  • Typography
  • Color
  • Layout
  • Position
  • Spacing
  • Grid
  • Flexbox
  • Miscellaneous
  • CSS prop
  • CSS in JS
  • 8-point grid
PreviousGetting StartedNextResponsive