<Div row> Use flexbox with ease in React! </Div>
- Easy to read & use flexbox!
- Accepts all standard div props! (like
style
,className
andid
) - Typescript support!
# with yarn:
yarn add div
# with npm:
npm install --save div
import React, { Component } from 'react'
import { Div } from 'div'
const Example = () => {
return (
<Div row>
<Div column flex={1}>
A third of the space
</Div>
<Div column flex={2}>
Two thirds of space!
</Div>
</Div>
)
}
(All props are optional)
- Applies
flex: {number}
. - Reminder: the flex shorthand params are in this order:
flex-grow
,flex-shrink
,flex-basis
(without commas)
- Makes div a flex row.
- Applies
display: flex
andflex-direction: row
.
- Makes div a flex column.
- Applies
display: flex
andflex-direction: column
.
- Reverses the flex-direction if
column
orrow
are specified.
- Applies
flex-wrap: 'wrap'
. - By default, a div's
flex-wrap
is'nowrap'
.
- Centers content if
row
orcolumn
are specified. - Applies
justify-content: 'center'
andalign-items: 'center'
.
MIT © Wulf