Home

Awesome

npm version

react-styled-box

What is it ?

This is a simple styled.div component, that makes your basic positioning of elements faster. Instead of writing all of the "styled" components upfront you can prototype the layout faster with this ready <Box>.

How it works ?

import Box from 'react-styled-box';

<Box flexDirection="column">
  <Box flexDirection="row">
    <span> header </span>
    <span> header 2 </span>
  </Box>

  <Box flexGrow={1}>
    <Box margin={10} padding="10px 0 0 0">
      Item one
    </Box>
    <Box margin={10} padding="10px 0 0 0">
      Item two
    </Box>
  </Box>
</Box>

What does it support ?

Check A Complete Guide to FlexBox

propTypevalid typessample valuesdescription
displaystring'flex', 'block'flex - default value
margininteger, string10, '50%'number values are suffixed with px
paddinginteger, string10, '50%'number values are suffixed with px
widthinteger, string10, '50%'number values are suffixed with px
maxWidthinteger, string10, '50%'number values are suffixed with px
minWidthinteger, string10, '50%'number values are suffixed with px
heightinteger, string10, '50%'number values are suffixed with px
maxHeightinteger, string10, '50%'number values are suffixed with px
minHeightinteger, string10, '50%'number values are suffixed with px
flexDirectionstring'row', 'column'
flexWrapstring'nowrap', 'wrap'
flexFlowstring'column nowrap', 'row wrap'
justifyContentstring'flex-start', 'center'
alignItemsstring'base-line', 'flex-start'
alignContentstring'flex-start', 'space-around'
orderinteger1, 2
flexGrowinteger1, 2
flexShrinkinteger1, 0
flexBasisinteger, string30, 'auto', '30%'number values are suffixed with px
flexstring'0 1 auto', '1 0'
alignSelfstring'auto', 'flex-start'
overflowstringvisible, hidden
overflowXstringvisible, hidden
overflowYstringvisible, hidden