Need help with vue-masonry?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

515 Stars 74 Forks MIT License 125 Commits 10 Opened issues


💠 Vue.js directive for masonry blocks layouting ✅

Services available


Need anything else?

Contributors list



Current version: 0.12.0

Vue.js directive for masonry blocks layouting. Original masonry library.

Plugin DEMO available ğŸŽ‰, JSFiddle DEMO

The plugin can be easily integrated with different CSS Frameworks. Check this Tailwind CSS DEMO.

You can also clone the basic demo repository vue-masonry + vue-cli webpack.


Install via NPM

  • Get from npm:

    npm install vue-masonry --save

    or from bower

    bower install vue-masonry
  • Make sure that the masonry library is included; for example using cdn link:

     or in other convenient way.

Usage with build tools

  • In your Vue app you'll have the following code:

    import Vue from 'vue'

    // import ES6 style import {VueMasonryPlugin} from 'vue-masonry';

    // or using CJS // const VueMasonryPlugin = require('vue-masonry').VueMasonryPlugin


Usage with Vue 3

  • Dependencies: mitt package
  • In your Vue 3 app, you'll have the following code

    import { createApp } from 'vue'
    import mitt from 'mitt'

    import { VueMasonryPlugin } from "vue-masonry/src/masonry-vue3.plugin";

    const emitter = mitt() let app = createApp(App) app.config.globalProperties.emitter = emitter app.use(VueMasonryPlugin) app.mount('#app')

Usage directly in the browser

Since v 0.11.3 in-browser usage is available using a direct script inclusion on the page like so:

var VueMasonryPlugin = window["vue-masonry-plugin"].VueMasonryPlugin


Properties that are currently available reproduce most of those on the original masonry plugin:

  • item-selector=".item"
    - list element DOM item selector;
  • transition-duration="0.3s
    - duration of transitions;
  • column-width="#test"
    - element selector for column width. Can be a selector string or a number;
  • origin-left="false"
    - set to group elements to the right instead of left by default;
  • origin-top="false"
    - set to group elements to the bottom instead of top by default;
  • stamp=".stamp"
    - specifies which elements are stamped within the layout;
  • gutter=".gutter-block-selector"
    - specifies [horizontal space between item elements]. Can be a selector string or a number. ( Set gutter to an Element or Selector String to use the outer width of the element;
  • fit-width="true"
    - sets the width of the container to fit the available number of columns;
  • horizontal-order="true"
    - lays out items to (mostly) maintain horizontal left-to-right order;
  • stagger="0.03s"
    - Staggers item transitions, so items transition incrementally after one another. Set as a CSS time format, '0.03s', or as a number in milliseconds, 30.
  • destroy-delay="0"
    - Amount of time (in milliseconds) to wait before unloading masonry via
    when the container is destroyed. This is useful during page/route transitions to ensure the layout is consistent while the transition takes place.

If you need to manually trigger masonry layout redraw (for example in case if your tile elements amount or content has changed) you can now use

method. As of 0.11.8 your can pass id of the block where you want to trigger the redraw.

(If you use old version

< 0.10.11
it can still be
, but please consider to upgrade)

NUXT ssr implementation

The best way to implement this is to use the no-ssr plugin.

  1. Create a file in your plugins folder called vue-masonry.js with the following contents:
import Vue from 'vue'
import {VueMasonryPlugin} from 'vue-masonry'


  1. Add this plugin to your
  plugins: [
    { src: '~/plugins/vue-masonry', ssr: false }

(NB make sure ssr is set to false)

  1. Add no-ssr and the markup for your vue-masonry to a component:



{{item}} - {{index}}

JS: ``` import NoSSR from 'vue-no-ssr'

export default { components: { 'no-ssr': NoSSR }, mounted () { if (typeof this.$redrawVueMasonry === 'function') { this.$redrawVueMasonry() } } } ```

An example implementation of vue-masonry with nuxt ssr can be found here -


Thanks to all the contributors for making the plugin better!

Questions, bugs

Known issues

  • Minor API change (JAN 2018). If you suddenly see error:
    Uncaught TypeError: _vue2.default.redrawVueMasonry is not a function
    - please upgrade your usage of the plugin's method
    in component methods from
    . See more details in #31 issue



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.