react-flexbox-slim
![NPM](https://nodei.co/npm/react-flexbox-slim.png?compact=true)
Customizable flexbox grid system for React
Installation
npm install --save react-flexbox-slim
Important Information
Defaults
{
xs: '0px',
sm: '540px',
md: '768px',
lg: '992px',
xl: '1200px',
}
12
Examples
<Row justifyContent='center'>
<Column xs={12} sm={4} md={6} lg={6} xl={3}>
<p>Hello,</p>
</Column>
<Column xs={12} sm={4} md={6} lg={6} xl={3}>
<p>World!</p>
</Column>
</Row>
const customBreakpoints = {
xs: '0px',
sm: '500px',
md: '800px',
lg: '1000px',
xl: '1600px',
};
const customMaxColumns = 16;
<Grid breakpoints={customBreakpoints} maxColumns={customMaxColumns}>
<Row justifyContent='center'>
/* Now you can use 16 column grid system */
<Column xs={16} sm={4} md={6} lg={6} xl={3}>
<p>Hello,</p>
</Column>
<Column xs={16} sm={4} md={6} lg={6} xl={3}>
<p>World!</p>
</Column>
</Row>
</Grid>
Components and Properties
Component | Props |
---|
<Grid> | See here for Grid props |
<Row> | Name | Type | Default | One Of |
---|
direction | String | 'row' | - 'row'
- 'row-reverse'
- 'column'
- 'column-reverse'
| wrap | String | 'wrap' | - 'nowrap'
- 'wrap'
- 'wrap-reverse'
| justifyContent | String | 'flex-start' | - 'flex-start'
- 'flex-end'
- 'center'
- 'space-between'
| alignContent | String | 'flex-start' | - 'flex-start'
- 'flex-end'
- 'center'
- 'space-between'
- 'space-around'
- 'space-evenly'
- 'stretch'
| alignItems | String | 'flex-start' | - 'flex-start'
- 'flex-end'
- 'center'
- 'baseline'
- 'stretch'
|
|
<Column> | Name | Type | Default |
---|
xs | Number | 12 | sm | Number | 12 | md | Number | 12 | lg | Number | 12 | xl | Number | 12 |
|
Grid Props
Name | Type |
---|
breakpoints | Object (see below for shape) |
maxColumns | Number |
If you wish to only change a single breakpoint value, you may do so. We will combine the default breakpoint values with the object you supplied
Note: this may cause issues with media queries
<Grid
breakpoints={{
xs: String,
sm: String,
md: String,
lg: String,
xl: String
}}
>
Allows you to specify the number of columns for the entire grid system
<Grid maxColumns={16}>