2121yarn add react-flex-ready
2222```
2323
24- ``` jsx
25- import React from " react" ;
26- import { render } from " react-dom" ;
27- import { Flex , Item } from " react-flex-ready" ;
28-
29- const myList = [{ title: " first" }, { title: " second" }, { title: " third" }];
30-
31- const Demo = () => (
32- < div>
33- < h1> Example< / h1>
34- < Flex>
35- {myList .map (({ title }, i ) => (
36- < Item key= {i} col= " 3" colTablet= " 3" colMobile= " 1" stretch>
37- < div
38- style= {{
39- textAlign: " center" ,
40- width: " 100%" ,
41- border: " 1px solid #eee"
42- }}
43- >
44- < h1> {title}< / h1>
45- < / div>
46- < / Item>
47- ))}
48- < / Flex>
49- < / div>
50- );
51-
52- render (< Demo / > , document .querySelector (" #root" ));
53- ```
24+ [ See Example] ( https://codesandbox.io/s/react-flex-ready-example-q6fdg )
5425
5526## Props
5627
@@ -61,7 +32,9 @@ These docs are inspired by reactjs-popup docs
6132| Option | Default | Type | Description |
6233| -------------------- | ----------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
6334| align | center | {string} | The way you want to align your items (` align-items ` )
64- | col | 1 | {string} | How many columns you have within your grid
35+ | col | | {number} | depends if you have like 5 elements and each one takes 4 out of 12 of space, will explain this more on a blog post
36+ | colTablet | | {number} | Same as col but on Tablet
37+ | colMobile | | {number} | Same as col but on Mobile
6538| as | div | {string, Component} | https://www.styled-components.com/docs/api#as-polymorphic-prop
6639| className | | {string} | you can add a className and style the component the way you wish
6740| style | | {object} | you can pass in CSS in JS directly
@@ -70,11 +43,11 @@ These docs are inspired by reactjs-popup docs
7043
7144| Option | Default | Type | Description |
7245| -------------------- | ----------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73- | col | 1 | {string } | How many columns of 12 your item will take on desktop |
74- | col | 1 | {string } | How many columns you have within your grid
75- | colTablet | 1 | {string } | How many columns of 12 your item will take on tablet
76- | colMobile | 1 | {string } | How many columns of 12 your item will take on mobile
77- | marginBottom | ` 3rem ` | {string } | Margin bottom of your item, last item always has 0 on mobile
46+ | gap | 1 | {number } | The gap value between your elements, 1 is highly recommended (it's not valid when your element takes 12 out of 12 of space)
47+ | col | 1 | {number } | How many columns out of 12 your item will take on desktop
48+ | colTablet | 1 | {number } | How many columns out of 12 your item will take on tablet
49+ | colMobile | 1 | {number } | How many columns out of 12 your item will take on mobile
50+ | marginBottom | ` 10px ` on mobile | {number } | Margin bottom of your item, last item always has 0 on mobile
7851| stretch | false | {bool} | Whether you want the items to have the same height or not
7952| as | div | {string, Component} | https://www.styled-components.com/docs/api#as-polymorphic-prop
8053| className | | {string} | you can add a className and style the component the way you wish
0 commit comments