
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
dynamic-react-grid
Advanced tools
Dynamic grid for react, responsive and inspired by the material-ui grid, however bringing greater simplicity, functionality and customization.
npm install --save dynamic-react-grid
yarn add dynamic-react-grid
This lib was inspired by the Grid of material-UI, containing similar assignments.

| Name | value | Description |
|---|---|---|
| row | true/false | If assigned, indicates to component that it should be a line |
| xs, xs-m, sm, sm-m, md, md-m, lg, lg-m, xl | recommendable: 0...12 (but it can be from 0 to infinity, but this is madness) | They are the standard breakpoints, but you can customize and create yours (we'll see that later). |
| spacing | 0...infinity | Defined in Grid tag with row props. Indicates column spacing, ranging from 0 to infinity. Default 0 |
| spacingY | 0...infinity | Defined in the Grid tag with row props. Indicates the vertical spacing of columns, ranging from 0 to infinity. |
| spacingX | 0...infinity | Defined in the Grid tag with row props. Indicates the horizontal column spacing, ranging from 0 to infinity. |
| direction | row row-reverse column column-reverse inherit initial unset | flex-direction values |
| justify | center flex-start flex-end space-between space-around inherit initial unset | justify-content values |
| alignContent | center flex-start flex-end space-between space-around stretch inherit initial unset | align-content values |
| align | normal stretch center start end flex-start flex-end self-start self-end baseline first baseline last baseline safe center unsafe center inherit initial unset | align-items values |
| wrap | nowrap wrap wrap-reverse inherit initial unset | flex-wrap values |
| self | auto center flex-start flex-end baseline stretch inherit initial unset | align-self values. Default wrap |
| order | 0...infinity | order values |
I can also put Breakpoints ramifications for the above mentioned props, example:
import Grid from 'dynamic-react-grid'
<Grid row spacing={2} or spacing={{xs:1, sm:4, md:3, /*...*/}}>
<Grid order={1} or order={{xs:1, sm:2, md:4, /*...*/}}>
</Grid>
</Grid>
<Grid row direction='row' or direction={{xs:'row', sm:'row-reverse', md:'column-reverse', /*...*/}}>
<Grid xs={12} md={6}>
</Grid>
</Grid>
This goes for all of the above props, except the row props
By default there are the following breakpoints:
{
xs: 0,
'xs-m': 300,
sm: 600,
'sm-m': 780,
md: 960,
'md-m': 1120,
lg: 1280,
'lg-m': 1600,
xl: 1920
}
However you can create your own points:
import {WithBreakpoints} from 'dynamic-react-grid'
let Grid = WithBreakpoints({
xs:0,
sm:400,
jsIsLife:600,
reactIsGood:1000
})
<Grid row>
<Grid row>
<Grid xs={6} jsIsLife={9} reactIsGood={12}>
...
</Grid>
</Grid>
</Grid>
you can also use window.breakpoints = {/.../} which dynamic-react-grid will automatically detect, but not recommended; if you're using React it can be, but if it's Next I don't recommend it due to problems related to server-side renderings, to revert this instead of window you can use globalThis, but then there are also issues related to the javascript or node version.
You can enter unique breakpoints for a given Grid tag:
<Grid row>
<Grid row>
<Grid bp-sm={100} bp-hello={500} sm={6} hello={9}>
...
</Grid>
</Grid>
</Grid>
/*@media(min-width):100 e @media(min-width):500*/
bp-* is short for breakpoint-*
The properties row and (the breakpoints) are independent. They can be combined.
<Grid row>
<Grid row xs={12} md={6}>
<Grid lg={5}>
...
</Grid>
</Grid>
</Grid>
There is a limitation with the negative margin we use to implement spacing between items. A horizontal scrollbar will appear if a negative margin goes beyond the <body>. There are 2 solutions available:
<body>
<div style={{ padding: 20 }}>
<Grid row spacing={5}>
//...
</Grid>
</div>
</body>
Both 4 columns below will have automatic widths, there is a flex-grow: 1 set by default, just set how to true the first breakpoint value:
<Grid row spacing={2}>
<Grid xs>xs</Grid>
<Grid xs>xs</Grid>
<Grid xs>xs</Grid>
<Grid xs>xs</Grid>
</Grid>
useful to be used with @emotion/styled or styled-components
import {media, mapMedia, breakpoints} from 'dynamic-react-grid'
let Container = styled.div(props => media(breakpoints)({
padding: 30,
color: 'red',
display: props.style.display,
// --------------------------------------
width: {xs:20, md:'50%', sm:'100vw'}
//or
width: mapMedia({xs:20, sm:30, md:40}, [key, val] => `calc(100px - ${val}px)`) // return -> {xs:'calc(100px - 20px)', sm:'calc(100px - 30px)', md:'calc(100px - 40px)'}
//or
width: mapMedia({xs:20, sm:30, md:40}, [key, val] => [`${key}-m`, `calc(100px - ${val}px)`]) // return -> {xs-m:'calc(100px - 20px)', sm-m:'calc(100px - 30px)', ...}
}))
//...
<Container
style={{
display: {
xs:'flex',
sm:'block',
md:'none',
/*...*/
}
}}
>
...
</Container>
FAQs
Dynamic grid for react, responsive and inspired by the material-ui grid, however bringing greater simplicity, functionality and customization.
We found that dynamic-react-grid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.