@lifeondesk/react-masonry-layout
v1.1.4
Published
Flexible and easy-to-use React library for creating responsive Masonry layouts with customizable brick sizes and responsive behavior.
Downloads
20
Readme
@lifeondesk/react-masonry-layout
Description
@lifeondesk/react-masonry-layout
is a flexible and easy-to-use React library for creating responsive Masonry layouts. The library provides a set of components that allow you to create Masonry-style grid layouts with customizable brick sizes and responsive behavior.
Features
- Easily create Masonry layouts with React components.
- Customize the size of bricks for different screen sizes.
- Responsive design with support for desktop, tablet, and mobile views.
- CSS Modules support for scoped styles.
Installation
To install the library, use npm or yarn:
npm install @lifeondesk/react-parallax-grid
or
yarn add @lifeondesk/react-parallax-grid
Usage
To use the Masonry layout in your React project:
1. Import the library's CSS file in your application.
import '@lifeondesk/react-parallax-grid/index.css';
2. Import the components
import the components from the library and render them in your component hierarchy.
import React from 'react';
import { Masonry, BrickCustom, BrickSmall, BrickMedium, BrickLarge } from '@lifeondesk/react-masonry-layout';
const MyMasonryLayout = () => {
return (
<Masonry>
<BrickCustom desktopBasis={33} tabletBasis={50} mobileBasis={100}>
{/* Your content here */}
</BrickCustom>
<BrickSmall>
{/* Your content here */}
</BrickSmall>
<BrickMedium>
{/* Your content here */}
</BrickMedium>
<BrickLarge>
{/* Your content here */}
</BrickLarge>
{/* Add more bricks as needed */}
</Masonry>
);
};
export default MyMasonryLayout;
Props
Masonry
The Masonry components accept various props for customization. Here are the common props:
className
: Additional CSS class names to apply to the brick.style
: Additional inline styles to apply to the brick.children
: The content to render inside the brick.
Brick
The Brick components accept various props for customization. Here are the common props:
className
: Additional CSS class names to apply to the brick.style
: Additional inline styles to apply to the brick.children
: The content to render inside the brick.
The specific props for each brick size (Custom, Small, Medium, Large) are as follows:
desktopBasis
: The flex basis of the brick on desktop screens (in percentage).tabletBasis
: The flex basis of the brick on tablet screens (in percentage).mobileBasis
: The flex basis of the brick on mobile screens (in percentage).fixed
: Will keep the brick to its basis size without automatically stretching to fill the space (false by default)
License
This project is licensed under the ISC License.
Contributions
Contributions to this project are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.
Changelog
Credits
This library is developed and maintained by lifeondesk.
Thank you for using @lifeondesk/react-masonry-layout
! If you have any questions or need further assistance, please feel free to reach out. Happy coding!