Skip to content

A vue plugin using Muuri's responsive, sortable, filterable and draggable grid layouts.

License

Notifications You must be signed in to change notification settings

jocodev1/vue-muuri

Repository files navigation

vue-muuri

npm vue2

A vue plugin using Muuri's responsive, sortable, filterable and draggable grid layouts.

Vue-muuri was created to provide an alternative option for creating a responsive dashboard in Vue. It is essentially a vue wrapper for Muuri. Using Vue's modular component system, vue-muuri allows us to drop in any number of tile components to quickly create our dashboard.

Installation

npm install --save vue-muuri

Bundler (Webpack)

import Vue from 'vue'
import VueMuuri from 'vue-muuri'
// You need a specific loader for CSS files like https://github.com/webpack/css-loader
import 'vue-muuri/dist/vue-muuri.css'

Vue.use(VueMuuri)

How to Use

Vue-muuri consists of a base muuri-grid component that implements the Muuri plugin. Using this component, we will be able to insert any number of item components through its slot.

Example:

    <muuri-grid id="example-grid">
      <!-- slot content -->
    </muuri-grid>

Out-of-the-box, vue-muuri comes with a few item components to get you started.

    import { ItemLink, ItemSm, ItemMd, ItemLg } from 'vue-muuri'
    <muuri-grid id="example-grid">
      <item-link id="link" text="Example Link" route="/"></item-link>
      
      <item-sm id="item-sm">
        <p>Small item.</p>
      </item-sm>
      
      <item-md id="item-md">
        <p>Medium item.</p>
      </item-md>
      
      <item-lg id="item-lg">
        <p>Large item.</p>
      </item-lg>
    </muuri-grid>

Events

Vue-muuri also allows you to listen to events on the grid object created by Muuri. Please refer to the docs for a complete list of events.

Example:

    <muuri-grid id="example-grid" @layoutEnd="updateOrder">
      <item-sm :id="'item-sm-' + index" v-for="num, index in [1,2,3,4]">
        <p>Item {{ num }}</p>
      </item-sm>
    </muuri-grid>
    // ...
    methods: {
        updateOrder (items) {
            console.log(items)
        }
    }

License

MIT

About

A vue plugin using Muuri's responsive, sortable, filterable and draggable grid layouts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published