This kit is used to build most of the complex interfaces. The Flex Kit is used the same way flex box is used.
horizontal
- Will be replaced with justify
vertical
- Will be replaced with align
spacing
- Will be removed. Use justify
orientation
| Type: String | Values: row | column import React from 'react' import { Flex, FlexItem, Title } from '../../' const FlexDefault = (props) => { return ( <> <Title size={4} text="Row" {...props} /> <br /> <div className="flex-doc-example"> <Flex orientation="row" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <Title size={4} text="Column" {...props} /> <br /> <div className="flex-doc-example"> <Flex align="start" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexDefault
inline
| Type: Boolean
By default this prop is false
which sets the flex container to take up the full width of its parent container. When the prop is set to true
the flex container sets its width to be the same size as the containing items.
import React from 'react' import { Flex, FlexItem, Title } from '../..' const FlexInline = (props) => { return ( <> <div className="flex-doc-example"> <Title size={4} text="Row" {...props} /> <br /> <Flex className="bg_light" inline {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> <br /> <Title size={4} text="Column" {...props} /> <br /> <Flex className="bg_light" inline orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexInline
reverse
| Type: Boolean
When set to true
this prop will reverse the order of items in the flex container.
import React from 'react' import { Flex, FlexItem, Title } from '../..' const FlexReverse = (props) => { return ( <> <div className="flex-doc-example"> <Title size={4} text="Row" {...props} /> <br /> <Flex className="bg_light" justify="start" orientation="row" reverse {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> <br /> <Title size={4} text="Column" {...props} /> <br /> <Flex align="start" className="bg_light" orientation="column" reverse {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexReverse
wrap
| Type: Boolean
When set to true
this prop will move the next item in flex container to a new line if there is no more room.
import React from 'react' import { Body, Flex, FlexItem, Title } from '../..' const FlexWrap = (props) => { return ( <> <div className="flex-doc-example"> <Body text="Resize your browser" {...props} /> <Title size={4} text="Wrap" {...props} /> <br /> <Flex className="bg_light" wrap {...props} > <FlexItem fixedSize="300px"> {'1'} </FlexItem> <FlexItem fixedSize="300px"> {'2'} </FlexItem> <FlexItem fixedSize="300px"> {'3'} </FlexItem> <FlexItem fixedSize="300px"> {'4'} </FlexItem> <FlexItem fixedSize="300px"> {'5'} </FlexItem> <FlexItem fixedSize="300px"> {'6'} </FlexItem> <FlexItem fixedSize="300px"> {'7'} </FlexItem> <FlexItem fixedSize="300px"> {'8'} </FlexItem> <FlexItem fixedSize="300px"> {'9'} </FlexItem> <FlexItem fixedSize="300px"> {'10'} </FlexItem> </Flex> <br /> <Title size={4} text="No Wrap" {...props} /> <br /> <Flex className="bg_light"> <FlexItem fixedSize="300px"> {'1'} </FlexItem> <FlexItem fixedSize="300px"> {'2'} </FlexItem> <FlexItem fixedSize="300px"> {'3'} </FlexItem> <FlexItem fixedSize="300px"> {'4'} </FlexItem> <FlexItem fixedSize="300px"> {'5'} </FlexItem> <FlexItem fixedSize="300px"> {'6'} </FlexItem> <FlexItem fixedSize="300px"> {'7'} </FlexItem> <FlexItem fixedSize="300px"> {'8'} </FlexItem> <FlexItem fixedSize="300px"> {'9'} </FlexItem> <FlexItem fixedSize="300px"> {'10'} </FlexItem> </Flex> </div> </> ) } export default FlexWrap
ATTENTION - the spacing prop will be deprecated & renamed in the future.
Deprecated Prop: spacing
| Type: String | Values: none | around | evenly | between
New Prop: justify
| Type: String | Values: none | around | evenly | between
import React from 'react' import { Flex, FlexItem, Title } from '../..' const FlexSpacing = (props) => { return ( <> <div className="flex-doc-example"> <Title size={4} text="None" {...props} /> <br /> <Flex className="bg_light" justify="none" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> <br /> <Title size={4} text="Around" {...props} /> <br /> <Flex className="bg_light" justify="around" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> <br /> <Title size={4} text="Between" {...props} /> <br /> <Flex className="bg_light" justify="between" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> <br /> <Title size={4} text="Evenly" {...props} /> <br /> <Flex className="bg_light" justify="evenly" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexSpacing
ATTENTION - the horizontal prop will be deprecated & renamed in the future.
Deprecated Prop: horizontal
| Type: String | Values: left | center | right | stretch | none
New Prop: justify
| Type: String | Values: start | center | end | | none
import React from 'react' import { Flex, FlexItem, Title } from '../..' const FlexJustify = (props) => { return ( <> <Title size={4} text="Row" {...props} /> <br /> <div className="flex-doc-example"> <Flex justify="start" orientation="row" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example"> <Flex justify="center" orientation="row" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example"> <Flex justify="end" orientation="row" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <Title size={4} text="Column" {...props} /> <br /> <div className="flex-doc-example tall"> <Flex align="start" className="bg_light tall" justify="start" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example tall"> <Flex align="start" className="bg_light tall" justify="center" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example tall"> <Flex align="start" className="bg_light tall" justify="end" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexJustify
ATTENTION - the vertical prop will be deprecated & renamed in the future.
Deprecated Prop: vertical
| Type: String | Values: top | center | bottom | stretch | baseline | none
New Prop: align
| Type: String | Values: start | center | end | stretch | baseline | none
import React from 'react' import { Flex, FlexItem, Title } from '../..' const FlexAlign = (props) => { return ( <> <Title size={4} text="Row" {...props} /> <br /> <div className="flex-doc-example "> <Flex align="start" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem padding="xl"> {'3'} </FlexItem> <FlexItem padding="md"> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example "> <Flex align="center" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem padding="xl"> {'3'} </FlexItem> <FlexItem padding="md"> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example "> <Flex align="end" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem padding="xl"> {'3'} </FlexItem> <FlexItem padding="md"> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example "> <Flex align="stretch" orientation="row" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem padding="xl"> {'3'} </FlexItem> <FlexItem padding="md"> {'4'} </FlexItem> </Flex> </div> <br /> <Title size={4} text="Column" {...props} /> <br /> <div className="flex-doc-example "> <Flex align="start" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example "> <Flex align="center" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example "> <Flex align="end" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example "> <Flex align="stretch" orientation="column" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexAlign
gap
| row_gap
| rowGap
| column_gap
| columnGap
| Type: String | Values: xs | sm | md | lg | xl | none
Setting the gap prop sets the rowgap || rowGap and the columngap || columnGap props to the same size and creates equal space within a flex container.
Setting the row_gap || rowGap prop creates space between rows in a flex container.
Setting the column_gap || columnGap prop creates space between columns in a flex container.
import React from 'react' import { Flex, FlexItem } from '../../' const FlexGap = (props) => { const count = () => { const array = [] for (let i = 0; i < 40; i++) { array.push(i) } return array } return ( <> <div className="flex-doc-example"> <Flex gap="xs" wrap {...props} > {count().map((v, key) => ( <FlexItem key={key}> {v} </FlexItem> ))} </Flex> </div> <br /> <div className="flex-doc-example"> <Flex columnGap="lg" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <div className="flex-doc-example"> <Flex orientation="column" rowGap="xl" {...props} > <FlexItem> {'1'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexGap
import React from 'react' import { Flex, FlexItem, Title } from '../../' const FlexItemExample = (props) => { return ( <> <Title size={4} text="Grow" /> <br /> <div className="flex-doc-example"> <Flex gap="xs" {...props} > <FlexItem grow> {'I\'m growing'} </FlexItem> <FlexItem> {'2'} </FlexItem> <FlexItem> {'3'} </FlexItem> <FlexItem> {'4'} </FlexItem> </Flex> </div> <br /> <Title size={4} text="Shrink" /> <br /> <div className="flex-doc-example"> <Flex gap="xs" {...props} > <FlexItem> {'I\'m shrinking'} </FlexItem> <FlexItem flex={1}> {'2'} </FlexItem> <FlexItem flex={1}> {'3'} </FlexItem> <FlexItem flex={1}> {'4'} </FlexItem> </Flex> </div> <br /> <Title size={4} text="Fixed Size" /> <br /> <div className="flex-doc-example"> <Flex gap="xs" {...props} > <FlexItem fixedSize="250px"> {'I\'m 250px'} </FlexItem> <FlexItem flex={1}> {'2'} </FlexItem> <FlexItem flex={1}> {'3'} </FlexItem> <FlexItem flex={1}> {'4'} </FlexItem> </Flex> </div> <br /> <Title size={4} text="Flex" /> <br /> <div className="flex-doc-example"> <Flex gap="xs" {...props} > <FlexItem flex={1}> {'1'} </FlexItem> <FlexItem flex={3}> {'2'} </FlexItem> <FlexItem flex={1}> {'3'} </FlexItem> <FlexItem flex={2}> {'4'} </FlexItem> </Flex> </div> </> ) } export default FlexItemExample