This is a React.js port of @e-oj's Magic Grid.
Please check the /example
folder for a example.
If you use images, make sure they have a set height, otherwise the grid will calculate weirdly.
There is also a React Hook version which requires at least
react@16.8
Install the component
$ npm i magic-grid-react magic-grid
import MagicGrid from 'magic-grid-react'
<MagicGrid>
{posts.map(post => (
<Card
style={{maxWidth: 200}}
key={post.id}
title={post.title}
body={post.body}
/>
))}
</MagicGrid>
Supports all optinons in Magic-Grid
Prop | Default | Comment |
---|---|---|
gutter | 32 |
Gap between elements |
maxCols | 5 |
Max number of colums |
useMin | false |
Use min width of columns |
animate | false |
Animate item positioning |
Thanks goes to these wonderful people (emoji key):
Arek Mytych 💻 📖 🤔 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!