koality-flexbox-grid v1.0.6
Koality Flexbox Grid
This aims to be a very simple Sass flexbox grid that isn't overly complicated or ends up being something you fight against while building.
How to use
You can get this project into like any node package: npm install koality-flexbox-grid
Then in your projects sass you will want to import it like @importnode_modules/koality-flexbox-grid/src/scss/flexbox-grid`. In doing that you can override some variables.
Classes
Container Classes
flex-container: adding that class to any element simply applies adisplay: flexto it.flex-wrapflex-nowrapflex-wrap-reverseflex-roworflex-dir-rowflex-dir-row-reverseflex-columnorflex-dir-columnflex-dir-column-reverseflex-jc-flex-startflex-jc-flex-endflex-jc-centerflex-jc-space-betweenflex-jc-space-aroundflex-jc-space-evenlyflex-ai-flex-startflex-ai-flex-endflex-ai-centerflex-ai-stretchflex-ai-baselineflex-ac-flex-startflex-ac-flex-endflex-ac-centerflex-ac-stretchflex-ac-space-betweenflex-ac-space-aroundflex-as-flex-endflex-as-centerflex-as-baselineflex-as-stretch
Item Classes
- By default all items are
flex: 1 1 100% - To control the width of you item you have the class format of
flex-X-Xwhere you can put any number from 1-12. It should work like most common CSS frameworks whereflex-2-3will make this item 66%. flex-shrink-0flex-grow-0flex-grow-2flex-grow-3flex-grow-4flex-grow-5
Responsive Classes
All classes listed can be prefixed with any breakpoint name to make it work on that breakpoint and up.
Available Breakpoints
$default: 0$sm: 576px$md: 768px$lg: 992px$xl: 1200px$breakpoints: ( default: $default, sm: $sm, md: $md, lg: $lg, xl: $xl, );
These can be overridden in your own project as long as you match the variable names. If you drop breakpoints from the $breakpoints sass map it will change the amount of breakpoints the Grid has, this will greatly reduce the amount of CSS the Grid uses.
Example:
md-flex-dir-colmn, lg-flex-2-3
Row Classes
row: will center the row and make it$row-width (default 1400px)and on screens smaller than it's width it will have gutters the width of$gutter-width (default 15px)row-fullwill be 100% width even able to break outside of arowand touch the edge of the screeninner-rowsame as row but only$inner-row-width (default 800px)
Variables
As much as we can we try to allow things to be user overridable. Here are currently all the variables you can change.
$row-width: 1400px;$inner-row-width: 800px;$default: 0;$sm: 576px;$md: 768px;$lg: 992px;$xl: 1200px;$breakpoints: ( default: $default, sm: $sm, md: $md, lg: $lg, xl: $xl, );$gutter-width: 15px;$flex-grid-count: 12;This will adjust the amount of columns in the grid.$flex-grow-default: 0;This will change wheither or not the grid items grow by default or not.$flex-shrink-default: 1;This will change wheither or not the grid items shrink by default or not.
Demo
1 year ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago