npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zxzinn/vue-waterfall

v0.2.1

Published

A performant, flexible waterfall/masonry layout component for Vue 3

Readme

@zxzinn/vue-waterfall

npm version npm downloads license

A performant, flexible waterfall/masonry layout component for Vue 3.

Features

  • Zero dependencies - Only Vue 3 as peer dependency
  • Performant - Uses CSS transforms and GPU acceleration
  • Smooth animations - Items animate smoothly when positions change
  • Flexible - Multiple layout modes (fixed width, fixed columns, breakpoints)
  • TypeScript - Full type support with generics
  • SSR Ready - Works with Nuxt and other SSR frameworks
  • Pre-calculated layouts - Provide item dimensions to avoid layout shifts

Installation

npm install @zxzinn/vue-waterfall
# or
pnpm add @zxzinn/vue-waterfall
# or
yarn add @zxzinn/vue-waterfall

Usage

Basic Usage

<script setup lang="ts">
import { Waterfall } from '@zxzinn/vue-waterfall'

interface Item {
  id: number
  title: string
  imageUrl: string
}

const items = ref<Item[]>([
  { id: 1, title: 'Item 1', imageUrl: '...' },
  { id: 2, title: 'Item 2', imageUrl: '...' },
])
</script>

<template>
  <Waterfall :items="items" :column-width="250" :gap="16">
    <template #default="{ item }">
      <div class="card">
        <img :src="item.imageUrl" :alt="item.title">
        <h3>{{ item.title }}</h3>
      </div>
    </template>
  </Waterfall>
</template>

With Pre-calculated Dimensions

If you know the dimensions of your items (e.g., from an API), you can provide them to avoid layout shifts:

<script setup lang="ts">
interface Artwork {
  id: number
  title: string
  thumbnailUrl: string
  width: number
  height: number
}

const artworks = ref<Artwork[]>([...])

// Provide dimensions for pre-calculation
function getItemSize(item: Artwork) {
  return { width: item.width, height: item.height }
}
</script>

<template>
  <Waterfall
    :items="artworks"
    :column-width="250"
    :gap="16"
    :get-item-size="getItemSize"
    :get-item-key="(item) => item.id"
  >
    <template #default="{ item }">
      <img :src="item.thumbnailUrl" :alt="item.title">
    </template>
  </Waterfall>
</template>

Fixed Columns Mode

<Waterfall :items="items" :columns="4" :gap="16">
  <!-- ... -->
</Waterfall>

Responsive Breakpoints

<Waterfall
  :items="items"
  :columns="{ default: 2, sm: 3, md: 4, lg: 5, xl: 6 }"
  :gap="16"
>
  <!-- ... -->
</Waterfall>

Breakpoints follow Tailwind CSS defaults:

  • sm: 640px
  • md: 768px
  • lg: 1024px
  • xl: 1280px
  • 2xl: 1536px

Props

| Prop | Type | Default | Description | | ---------------------- | ----------------------- | -------- | --------------------------------------- | | items | T[] | Required | Array of items to render | | columnWidth | number | 250 | Minimum column width in pixels | | columns | number \| Breakpoints | - | Fixed column count or breakpoint config | | gap | number | 16 | Gap between items in pixels | | getItemSize | (item, index) => Size | - | Function to get item dimensions | | getItemKey | (item, index) => string \| number | index | Unique key getter (important for animations) | | animate | boolean | true | Enable transition animations | | animationDuration | number | 300 | Transition duration in ms | | ssrPlaceholderHeight | number | 200 | Placeholder height for SSR |

Slot Props

The default slot receives:

| Prop | Type | Description | | ------------- | ---------- | ----------------------------------------------------- | | item | T | The current item | | index | number | Item index | | position | Position | Calculated position { x, y, width, height, column } | | columnWidth | number | Actual column width |

Exposed Methods

<script setup>
const waterfallRef = ref()

// Force recalculate layout
waterfallRef.value?.recalculate()

// Get current column count
const columns = waterfallRef.value?.getColumnCount()

// Get container height
const height = waterfallRef.value?.getContainerHeight()
</script>

<template>
  <Waterfall ref="waterfallRef" :items="items">
    <!-- ... -->
  </Waterfall>
</template>

Composable

For advanced use cases, you can use the useWaterfall composable directly:

<script setup>
import { useWaterfall } from '@zxzinn/vue-waterfall'

const containerRef = ref(null)
const items = ref([...])

const {
  positions,
  columnCount,
  actualColumnWidth,
  containerHeight,
  recalculate,
} = useWaterfall({
  items,
  containerRef,
  columnWidth: ref(250),
  gap: ref(16),
  getItemKey: (item) => item.id,
})
</script>

Contributing

Contributions are welcome! Feel free to open an issue or submit a PR.

License

MIT