
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
react-layout-masonry
Advanced tools
React Layout Masonry is a flexible and customizable React component for creating dynamic and fixed/responsive masonry layouts.
You can install React Layout Masonry using npm, pnpm or yarn:
npm install react-layout-masonry
or
pnpm install react-layout-masonry
or
yarn add react-layout-masonry
Here's an example of how to use React Layout Masonry with a fixed number of columns in your React application:
import Masonry from 'react-layout-masonry';
const FixedColumnsMasonry = () => {
return (
<Masonry
columns={3}
gap={16}
>
{items.map((item) => {
return <Item {...item} />;
})}
</Masonry>
);
};
export default FixedColumnsMasonry;
Here's an example of how to use React Layout Masonry with responsive columns in your React application:
import Masonry from 'react-layout-masonry';
const ResponsiveColumnsMasonry = () => {
return (
<Masonry
columns={{ 640: 1, 768: 2, 1024: 3, 1280: 5 }}
gap={16}
>
{items.map((item) => {
return <Item {...item} />;
})}
</Masonry>
);
};
export default ResponsiveColumnsMasonry;
or use the array syntax
<Masonry columns={[1, undefined, undefined, 3]} />
this will be converted to
{
"640": 1,
"1280": 3
}
The array's order corresponds to the default breakpoints, which are 640, 786, 1024, 1280, 1536
.
The columnProps
prop allows you to apply additional props to the container of each column. Here's an example:
<Masonry
columns={3}
gap={16}
columnProps={{
className: 'custom-column',
style: { backgroundColor: 'lightgray' },
}}
>
{/* ... */}
</Masonry>
columns
(number or object, required): The number of columns in the masonry layout, or an object with breakpoints and corresponding column counts.gap
(number, optional): The spacing between columns and rows in pixels. Defaults to 0.columnProps
(object, optional): Additional props to be applied to each column, such as className for styling.For examples, usage and customization options, please refer to the docs directory in this repository.
If you encounter any issues or have questions, please open an issue on our GitHub repository. Make sure to create an issue or discussion first before raising a PR
React Layout Masonry is open-source software licensed under the MIT License.
v2.0.0 (2025-07-06)
Changed breakpoint matching logic from >
to >=
. When window width exactly matches a breakpoint value, that breakpoint is now active instead of the previous one. This aligns with standard CSS media query behavior where min-width: 768px
activates at exactly 768px. (c4b4cbb)
[!NOTE] If you rely on the previous behavior where a window width of exactly 768px would use the 640px breakpoint configuration, you may need to adjust your breakpoint values accordingly.
FAQs
Responsive masonry layout for React
The npm package react-layout-masonry receives a total of 1,335 weekly downloads. As such, react-layout-masonry popularity was classified as popular.
We found that react-layout-masonry demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.