Press "Enter" to skip to content

Responsive Masonry Layout with SSR Support for Vue 3 | vue-masonry-wall

Vue masonry wall is a responsive masonry layout component for Vue 3 to deliver a Masonry-style responsive grid layout with SSR and RTL layout support.

masonry grid gallery, vue masonry gallery, vue masonry css, masonry js responsive, vue 3 masonry, npm masonry, simple masonry layout

Features

  • 📱 Responsive: Responsive to configurable column widths and gaps. Based on ResizeObserver.
  • Reaction: reacts to changes in properties.
  • 🪶 Lightweight: zero dependencies. Less than 1.2 KB.
  • ⬅️ RTL: Supports LTR and RTL layouts.

How to make use of it:

Install and download:

# Yarn
$ yarn add @yeger/vue-masonry-wall

# NPM
$ npm i @yeger/vue-masonry-wall --save

1. Import and register the component.

import { createApp } from 'vue'
import MasonryWall from '@yeger/vue-masonry-wall'
const app = createApp()
app.use(MasonryWall)

2. This example shows how to display the basic build layout in your application.

<template>
  <masonry-wall :items="items" :ssr-columns="1" :column-width="300" :padding="16">
    <template #default="{ item, index }">
      <div style="height: 150px">
        <h1>{{ item.title }}</h1>
        <span>{{ item.description }}</span>
      </div>
    </template>
  </masonry-wall>
</template>
export default {
  data() {
    return {
      items: [
        { title: 'First', description: 'The first item.' },
        { title: 'Second', description: 'The second item.'},
        { title: 'Third', description: 'The third item.'},
        // more items here
      ]
    }
  }
}

3. Props component.

  • items: Array of items. Required.
  • column-width: Minimal width of columns in px.
  • gap: Spacing between items in px. Defaults to 0.
  • rtl: Toggles between LTR (false) and RTL (true) layouts. Defaults to false.
  • ssr-columns: Number of server-side-rendered columns. Optional.
items: {
  type: Array as PropType<unknown[]>,
  required: true,
},
ssrColumns: {
  type: Number as PropType<number | undefined>,
  default: undefined,
},
columnWidth: {
  type: Number,
  default: 400,
},
padding: {
  type: Number,
  default: 0,
},
rtl: {
  type: Boolean,
  default: false,
},

Masonry Layout With SSR Support, vue masonry wall Plugin/Github


See Demo And Download

Official Website(DerYeger): Click Here

This superior jQuery/javascript plugin is developed by DerYeger. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.