masua

0.11.4 • Public • Published

masua

masua

Simple masonry layout library in TypeScript. Initially forked from minimasonry by Spope.

Installation

⚠️ This plugin is published as TypeScript and JSX (for the React plugin) see this post on 𝕏 for the reasoning. Make sure to add the necessary types listed below if they are missing in your project and align your tsconfig.json with { compilerOptions: { lib: ['DOM', 'ES2020'], module: 'Preserve', jsx: 'react-jsx' }} as used for this project. React is only required when the masua/react export is used.

bun install masua
bun install @types/bun # or @types/node
bun install @types/react # for React export

Usage

import { grid } from 'masua'

grid(document.querySelector('#my-grid'))
// With configuration options.
grid(document.querySelector('#my-custom-grid'), {
  gutter: 20,
  baseWidth: 300,
  minify: false,
  surroundingGutter: true,
  singleColumnGutter: 10,
  direction: 'rtl',
  wedge: true,
})

React

import { Grid } from 'masua/react'

const MyGrid = () => (
  <Grid disabled={window.innerWidth < 501}>
    <Box />
    <Box size={3} />
    <Box size={2} />
    <Box />
    <Box size={6} />
    <Box size={4} />
  </Grid>
)

Package Sidebar

Install

npm i masua

Weekly Downloads

82

Version

0.11.4

License

MIT

Unpacked Size

14.9 kB

Total Files

4

Last publish

Collaborators

  • tobua