JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q33606F
  • License MIT

React brick layout is a masonry layout component

Package Exports

  • react-brick-layout
  • react-brick-layout/dist/cjs/index.js
  • react-brick-layout/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-brick-layout) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-brick-layout

NPM version Build npm-typescript License

react-brick-layout is lightweight, performant, and responsive masonry layout component that arranges elements in a grid-like structure, with elements of varying heights. The elements are placed in such a way that there are minimal gaps between them, creating a cohesive and visually appealing layout.

Live Demo

Installation:

npm install react-brick-layout --save-dev

or

yarn add -D react-brick-layout

Usage :

To use the react-brick-layout library, you would first need to install it in your project by running npm install react-brick-layout or yarn add react-brick-layout. Once the library is installed, you can import the Masonry component and use it in your application.

Here's an example of how you can use the BrickLayout component to create a simple Masonry layout in a React application:

import React from 'react'
import { BrickLayout } from 'react-brick-layout'

const Masonry = () => {
  return (
    <BrickLayout gutter={10} column={5}>
      <div>Element 1</div>
      <div>Element 2</div>
      <div>Element 3</div>
      <div>Element 4</div>
      <div>Element 5</div>
    </BrickLayout>
  )
}

export default Masonry

Props

name type required default description
style object No {} CSS style for the BrickLayout component
children null No null ❌❗ Do not pass children as props. Instead, nest children between the opening and closing tags
column number No 3 Column count
gutter number No 10 The size(px) of the gap between elements
animateOnResize boolean No true Animate layout on screen resize
className string No react-brick-layout Custom class name of layout container
rtl boolean No false Change layout right to left
breakPoint object No {350: 1, 450: 2, 645: 3, 900: 4, 1200: 5} Used for responsive layout. The point at which the screen size(px) changes

Conclusion

This package provides a simple, lightweight solution for creating responsive brick-style layouts in React. It allows for customization of the layout to suit your specific needs and requirements. If you find it useful, please consider giving it a positive rating or review. Thank you!