flex-stack

A simple flexbox utility tool

Usage no npm install needed!

<script type="module">
  import flexStack from 'https://cdn.skypack.dev/flex-stack';
</script>

README

Flex Stack is a easy-to-use React component which creates flex-box divs with simple annotations

Stack uses annotation props and converts them to style properties, so you do not have to write long and repetitive css code. You can easily create flex layouts with a few props.

Sample

<Stack  fill  g12  p12  bg='#fefefe'  xs={{ column:  true }}  >
    <Stack  size={10}  bg='Salmon'  color='white'/>
    <Stack  column  g12  p12  fill  bg='SteelBlue'  color='white'  >
        <Stack  ac  je  g12  p12  size={10}  xs={{ js:  true }}  bg='PaleVioletRed'  color='white'  >
            <Stack  h={5}  w={5}  bg='Teal'  xs={{ hidden:  true }}  color='white'/>
            <Stack  h={5}  w={5}  bg='LightGreen'  color='white'/>
            <Stack  h={5}  w={5}  bg='Plum'  color='white'/>
        </Stack>
        <Stack  je  g12  fill  xs={{ column:  true, js:  true }}  color='white'  >
            <Stack  fill  bg='RebeccaPurple'  color='white'/>
            <Stack  size='200px'  bg='Olive'  color='white'/>
        </Stack>
    </Stack>
</Stack  >

Props

The props you can use and which style properties this props add are as follows

Note: Stack props are applied in an order and some props may override previous ones. Use cautiously

|Prop |is the Root | is a Child | Notes| |--|--|--|--| | row | flex-direction: row | flex-direction: row| This the default value. If you do not provide a direction, flex is a row | | column | flex-direction: column | flex-direction: column| | | fill | width: '100%', height: '100%' | flex-grow: 1 | | | size | | | | | w | | | | | h | | | | | center | | | | | stretch | | | | | doNotStretch | | | | | ac | | | | | as | | | | | abln | | | | | jc | | | | | je | | | | | js | | | | | jsb | | | | | bg | | | | | bgColor | | | | | wrap | | | | | shadow | | | | | sv | | | | | scrollVertical | | | | | sh | | | | | scrollHorizontal | | | |