React Grider is a css-grid based micro-library.
npm install --save react-grider
React Grider is set by default to build a grid with four 25% width columns and a infinite number of rows with automatic height.
importReact,{Component}from'react'importGriderfrom'react-grider'exportdefaultclassAppextendsComponent{render(){return(<Grider><Grider.Item>
Test
</Grider.Item><Grider.Item>
Test
</Grider.Item><Grider.Item>
Test
</Grider.Item><Grider.Item>
Test
</Grider.Item></Grider>)}}You can define your own grid by setting the
cols,rows,gap,heightandwidthprops on theGridercomponent andcolStart,colEnd,rowStart,rowEndin theGrider.Itemcomponent props. I'ts possible to view a wireframe of your items by adding the propwireframeto theGrider.Item.
importReact,{Component}from'react'importGriderfrom'react-grider'exportdefaultclassAppextendsComponent{render(){return(<Gridergap="10px"height="auto"width="100%"cols="25% 50% 25%"rows="250px 200px"><Grider.ItemcolStart={1}colEnd={1}rowStart={1}rowEnd={3}wireframe>
Item 1
</Grider.Item><Grider.ItemcolStart={2}colEnd={2}rowStart={1}rowEnd={2}wireframe>
Item 2
</Grider.Item><Grider.ItemcolStart={2}colEnd={4}rowStart={2}rowEnd={2}wireframe>
Item 3
</Grider.Item><Grider.ItemcolStart={3}colEnd={3}rowStart={1}rowEnd={1}wireframe>
Item 4
</Grider.Item></Grider>)}}
colsandrowscould be an integer also. If you use an integer to define them, the grid will be divided innequal columns and rows in relation to the sizes of the theGridercomponent's.
importReact,{Component}from'react'importGriderfrom'react-grider'exportdefaultclassAppextendsComponent{render(){return(<Gridergap="10px"height="300px"width="100%"cols={4}rows={4}><Grider.Itemwireframe>
Item 1
</Grider.Item><Grider.Itemwireframe>
Item 2
</Grider.Item><Grider.Itemwireframe>
Item 3
</Grider.Item><Grider.Itemwireframe>
Item 4
</Grider.Item><Grider.Itemwireframe>
Item 5
</Grider.Item><Grider.ItemcolStart={2}colEnd={5}wireframe>
Item 6
</Grider.Item></Grider>)}}It's possible to add custom css class to your items by using the prop
className
<Grider.ItemclassName="customClass"wireframe>
Test
</Grider.Item>I'm working to add a template feature with named areas.
MIT © VLK-STUDIO


