Infinite Masonry

Preview

Install

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

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

API Reference

items
readonly T[]
Default—
getItemKey
(item: T, index: number) => InfiniteMasonryKey
Default—
renderItem
(item: T, index: number) => ReactNode
Default—
onLoadMore
() => void | Promise<void>
Default—
hasMore
boolean
Default—
loading?
boolean
Defaultfalse
error?
ReactNode
Default—
onRetry?
(() => void)
Default—
estimateSize?
((item: T, index: number) => number)
Default() => 240
renderLoadingItem?
((index: number) => ReactNode)
Default(index) => <DefaultLoadingItem index={index} />
emptyState?
ReactNode
Default—
endState?
ReactNode
Default—
minColumnWidth?
number
Default208
maxColumns?
number
Default4
gap?
number
Default12
overscan?
number
Default4
prefetch?
number
Default3
animateItems?
boolean
Defaulttrue
ariaLabel?
string
Default—
className?
string
Default—
contentClassName?
string
Default—
itemClassName?
string
Default—
labels?
Partial<{ label: string; emptyTitle: string; emptyDescription: string; loadError: string; retry: string; loadingMore: string; }>

Override any built-in string.

Default—

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