Infinite Masonry

Responsive virtualized masonry that measures variable-height cards and loads more data as the user nears the end.

Preview

Visual index

Scroll to load the next page

12 items

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/infinite-masonry

API Reference

items
readonly T[]
—
getItemKey
(item: T, index: number) => InfiniteMasonryKey
—
renderItem
(item: T, index: number) => ReactNode
—
onLoadMore
() => void | Promise<void>
—
hasMore
boolean
—
loading?
boolean
false
error?
ReactNode
—
onRetry?
(() => void)
—
estimateSize?
((item: T, index: number) => number)
() => 240
renderLoadingItem?
((index: number) => ReactNode)
(index) => <DefaultLoadingItem index={index} />
emptyState?
ReactNode
<DefaultEmptyState />
endState?
ReactNode
—
minColumnWidth?
number
208
maxColumns?
number
4
gap?
number
12
overscan?
number
4
prefetch?
number
3
animateItems?
boolean
true
ariaLabel?
string
Infinite masonry feed
className?
string
—
contentClassName?
string
—
itemClassName?
string
—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated