
Security News
Suno Breached via Shai-Hulud Worm, Leaked Code Exposes AI Music Scraping
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.
@virtuoso.dev/masonry
Advanced tools
A virtualized masonry layout component for React that arranges items in a grid with varying heights.
:::note The column distribution algorithm distributes the items just-in-time, so if you scroll very fast, you will be able to see the arrangement happening. :::
npm install @virtuoso.dev/masonry
import { VirtuosoMasonry } from '@virtuoso.dev/masonry'
import { useMemo } from 'react'
const ItemContent: React.FC<{ data: number }> = ({ data }) => {
const height = data % 10 === 0 ? 200 : data % 5 === 0 ? 180 : data % 7 ? 150 : 120
return (
<div style={{ padding: '5px' }}>
<div style={{ height, border: '1px solid black' }}>Item {data}</div>
</div>
)
}
export default function App() {
const data = useMemo(() => {
return Array.from({ length: 1000 }, (_, index) => index)
}, [])
return (
<div>
<VirtuosoMasonry columnCount={3} data={data} style={{ height: 500 }} initialItemCount={50} ItemContent={ItemContent} />
</div>
)
}
import { VirtuosoMasonry } from '@virtuoso.dev/masonry'
import { useEffect, useMemo, useState } from 'react'
function useWindowWidth() {
const [width, setWidth] = useState(window.innerWidth)
useEffect(() => {
const handleResize = () => setWidth(window.innerWidth)
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
}, [])
return width
}
const ItemContent: React.FC<{ data: number }> = ({ data }) => {
const height = data % 10 === 0 ? 200 : data % 5 === 0 ? 180 : data % 7 ? 150 : 120
return (
<div style={{ padding: '5px' }}>
<div style={{ height, border: '1px solid black' }}>Item {data}</div>
</div>
)
}
export default function App() {
const data = useMemo(() => {
return Array.from({ length: 1000 }, (_, index) => index)
}, [])
const width = useWindowWidth()
const columnCount = useMemo(() => {
if (width < 500) {
return 2
}
if (width < 800) {
return 3
}
return 4
}, [width])
return (
<div>
<VirtuosoMasonry columnCount={columnCount} data={data} useWindowScroll={true} initialItemCount={50} ItemContent={ItemContent} />
</div>
)
}
FAQs
Virtualized React component for rendering masonry layouts
The npm package @virtuoso.dev/masonry receives a total of 34,821 weekly downloads. As such, @virtuoso.dev/masonry popularity was classified as popular.
We found that @virtuoso.dev/masonry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A Shai-Hulud infection exposed Suno's source code, which shows the AI music startup stream-ripped tracks to train its models.

Security News
Vercel is formalizing a monthly release program for Next.js. The change follows React2Shell and a sharp rise in AI-assisted vulnerability discovery.

Research
/Security News
11 malicious NuGet tools pose as game cheats to deploy Windows payloads, track hosts, and use Google Sheets for telemetry and control.