Code Monkey home page Code Monkey logo

vue-stack-grid's Introduction

vue-stack-grid

Vue components for stack grid/waterfall/Pinterest type layouts. Inspired by react-stack-grid.

Demo

Coming soon. Please see react-stack-grid for an indication of the features.

Installation

NPM:

npm install --save vue-stack-grid

Usage

Basic

<template>
  <div>
    <stack :column-min-width="320" :gutter-width="8" :gutter-height="8">
      <stack-item v-for="(item, i) in items" :key="i">
        {{ item.someContent }}
      </stack-item>
    </stack>
  </div>
</template>

<script>
  import { Stack, StackItem } from 'vue-stack-grid';

  export default {
    components: { Stack, StackItem }
  }
</script>

With animation

For animation, simply add style="transition: transform 300ms" to the stack-items.

With images

If images appear anywhere in the stack items, apply the monitor-images-loaded prop to the stack component.

Props

Stack

Name Type Required Default Description
column-min-width Number Yes The minimum width of columns. If the columns do not fit into the container anymore, the number of columns is reduced.
gutter-width Number No 0 The space between columns in pixels.
gutter-height Number No 0 The space between items in the same column.
monitor-images-loaded Boolean No false If true, reflow once all images are loaded using vue-images-loaded. This is recommended if any of the stack items contain images, as the images might not be loaded yet when the initial positions and sizes are computed.

Note that gutter-width and gutter-height can also be replaced by adding margin/padding to the stack items.

Examples

Clone the repository and run: npm run examples

Future plans

  • Handle adding/removing items.
  • Add build system.
  • Add demo.
  • Please make feature requests if you have any!

vue-stack-grid's People

Contributors

wouterflorijn avatar dependabot[bot] avatar 0xch4z avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.