react-flex-material
Flex component built for React based on Angular Material Flex Layout which's features provide sugar to enable developers to more easily create modern, responsive layouts on top of CSS3 flexbox.
Installation
react-flex-material is distributed via npm:
$ npm i -S react$ npm i -S react-flex-material
Configuration
There are several ways to load react-flex-material. Preferable way is using webpack
css-loader
Webpack with;;...
Webpack configuration
... test: /\.css$/ loader: ExtractTextPlugin...
In this case required styles will be loaded automatically.
css-modules
Webpack with;;...
And webpack configuration
...module: test: /\.scss$/ loader: ExtractTextPlugin ...
You will need a couple of loaders for webpack:
npm install node-sass sass-loader postcss postcss-loader
Including postcss for autoprefixer to make more browser compatible CSS.
Using library without webpack
In this case you load library without styles
;;...
And then load them separately
Documentation
The library is based on Angular Material Flex Layout. So you can use their documentation as a main source.
Only one change. Since this library is for React, we are using camelCased
style instead of snake-cased
.
Base attributes are 'layout', 'flex', 'order', 'offset', 'align', 'hide', 'show'
Responsive modifiers '', 'Xs', 'GtXs', 'Sm', 'GtSm', 'Md', 'GtMd', 'Lg', 'GtLg'
Some other attributes 'layoutWrap', 'layoutNoWrap', 'layoutFill', 'layoutMargin', 'layoutPadding'
So you'll get 'layoutXs', 'layoutGtSm', 'flexGtXs', 'flexGtMd', 'orderSm'
etc
The value for attributes is the same to Angular Material Flex Layout
... ... ...
Examples
Library has only one Main component called Flex
.
By default Flex
is just a div
. But you can change it via tag
attribute
...
Basic row:

Col 1 Col 2
For row layout, attribute value could be omitted:
Col 1 Col 2
Row layout with equal columns:

Col 1 Col 2
Row layout with a specific columns width

Col 1 Col 2
Row layout with a specific alignment

Col 1 Col 2
Column layout with a specific alignment
Important: use it only if you need a specific alignment. <Flex layout="column" />
is the same to <Flex />
by default.
Row 1 Row 2
Flex
called divider
.
Special attribute for If you want to add some space between components.
Col 1 Col 2