G
Tokens
TypographySpacingColorRadiusShadowMotion

Flex

Playground

justifyContent
alignItems
direction
wrap
alignContents
0 1 auto
0 1 auto
0 1 auto

Examples

Algorythmic layout

Responsiveness without media queries

  • fixed left section, 200px
  • fluid right section, wraps after 600px

    <Flex wrap="wrap">
      <Box flex="1 200px" borderSide="all" borderColor="shade10" padding="l">A</Box>
      <Box flex="10000 600px" borderSide="all" borderColor="shade10" padding="l">B</Box>
    </Flex>

Sections with different widths


    <Flex>
      {['A', 'B', 'C', 'D', 'E'].map((letter, index) => (
        <Box
          key={index}
          flex="1 1 280px"
          borderSide="all"
          borderColor="shade10"
          padding="l"
        >
          {letter}
        </Box>
      ))}
    </Flex>

Tag list

  
    <Flex wrap="wrap" gap="xs">
      {numerals.map((numeral, index) => (
        <Box
          key={index}
          paddingX="s"
          paddingY="xs"
          radius="xs"
          borderSide="all"
          borderColor="shade10"
        >
          {numeral}
        </Box>
      ))}
    </Flex>

Props

Box

Includes all Box props.

Flex

Name
Type
Default
directionRESPONSIVE
oneOfType
oneOf
'row' 'column'
object
'row'
wrapRESPONSIVE
oneOfType
oneOf
'nowrap' 'wrap' 'wrap-reverse'
object
'wrap'
justifyContentRESPONSIVE
oneOfType
oneOf
'start' 'end' 'center' 'stretch' 'baseline' 'space-around' 'space-between' 'space-evenly'
object
'start'
alignItemsRESPONSIVE
oneOfType
oneOf
'start' 'end' 'center' 'stretch' 'baseline'
object
'start'
alignContentRESPONSIVE
oneOfType
oneOf
'start' 'end' 'center' 'stretch' 'baseline' 'space-around' 'space-between' 'space-evenly'
object
'start'
gapRESPONSIVE
oneOfType
oneOf
"xs" "s" "s2" "m" "l" "l2" "xl" "xl2" "xxl"
number
string
object
columnGapRESPONSIVE
oneOfType
oneOf
"xs" "s" "s2" "m" "l" "l2" "xl" "xl2" "xxl"
number
string
object
rowGapRESPONSIVE
oneOfType
oneOf
"xs" "s" "s2" "m" "l" "l2" "xl" "xl2" "xxl"
number
string
object