An open API service indexing awesome lists of open source software.

https://github.com/jannchie/vue-wf

Vue waterfall layout
https://github.com/jannchie/vue-wf

Last synced: 5 months ago
JSON representation

Vue waterfall layout

Awesome Lists containing this project

README

          

# Vue WF

[![CodeTime badge](https://img.shields.io/endpoint?style=social&url=https%3A%2F%2Fapi.codetime.dev%2Fshield%3Fid%3D2%26project%3Dvue-wf%26in%3D0)](https://codetime.dev)


Example

## Sites

- Documentation: https://vue-wf.jannchie.com
- Playground demo: https://vue-wf.playground.jannchie.com

## Install

```bash
pnpm install vue-wf
```

## Usage

```vue

import Waterfall from 'vue-wf'

const tmps = Array.from({ length: 100 })
const heights = [50, 100, 200, 300, 400]
const width = 100
const items = tmps.map(() => {
const height = heights[Math.floor(Math.random() * heights.length)]
return {
width,
height,
src: `https://picsum.photos/${width}/${height}?random=${Math.random()}`,
}
})



```

### Props

- `item-padding`: extra space around each item (useful for captions or badges). Accepts a number for both axes or an object `{ x, y }`. The legacy `y-gap` prop now maps to `item-padding.y`.
- `items`: array of `{ width, height }` objects. Both fields are required numbers and are validated at runtime.

### Virtual rendering tips

- Set the outer container to a fixed height with `overflow: auto` (e.g., `height: 100vh; overflow: auto;`). This allows the component to measure the viewport and only render items inside (plus the `rangeExpand` buffer).
- If `rangeExpand` is set to `0`, only the items currently in view are rendered. Increase it to preload items above/below the viewport for smoother scrolling.

## Packages

- `packages/vue-wf`: core library source and build artifacts.
- `packages/docs`: VitePress documentation site.
- `packages/playground`: interactive playground project.

## Development

```bash
pnpm install
pnpm build
pnpm dev:all
```