Components / Layout and type
Masonry
Cards of different heights packed into columns, Pinterest-style (MUI Lab's Masonry). Items flow top-to-bottom per column.
import { Masonry } from "@stylhero/ui";
Example
Code
import { Masonry, Paper } from "@stylhero/ui";
function MasonryExample() {
return (
<Masonry columns={3} gap={3}>
{[80, 140, 100, 60, 120, 90].map((h, i) => <Paper key={i} outlined style={{ height: h }} padding={3}>{i + 1}</Paper>)}
</Masonry>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
columns |
number |
3 |
|
gap |
Space |
4 |
Also takes every <div> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.
Types
type Space = 0 | 1 | 2 | 3 | 4 | 6 | 8 | 12;
Generated from src/components/ImageList.tsx. Something wrong or missing? Open an issue.