Mobile-friendly List Scroller For Vue – horizontal-list

Description:

A responsive, mobile-friendly, touch-enabled list scroller for scrolling through posts, articles, images, quotes just like a carousel.

How to use it:

1. Import the vue-horizontal-list component.

import Vue from 'vue';
import VueHorizontalList from '@/vue-horizontal-list.vue';

2. Add the component to the app template.

<vue-horizontal-list :items="items" :options="options">
  <template v-slot:default="{item}">
    <div class="item">
      <h5>{{item.title}}</h5>
      <p>{{item.content}}</p>
    </div>
  </template>
</vue-horizontal-list>

3. Render the vue-horizontal-list on the app.

export default Vue.extend({
  name: 'Name',
  components: {
    VueHorizontalList
  },
  data() {
    return {
      options: {
        // options here
      },  
      items: [
        {title: 'Item 0', content: 'Content item with description'},
      ]
    }
  }
});

4. Default props.

/**
 * items to display in horizontal-list
 */
items: {
  type: Array,
  required: true
},
/**
 * item.class = css class for each individual item
 * item.padding = padding between each item in the list
 *
 * list.class = css class for the parent of item
 * list.windowed = maximum width of the list it can extend to, basically the container max-width
 * list.padding = padding of the list, if container < windowed what is the left-right padding of the list
 *
 * responsive breakpoints to calculate how many items to show in the list at each width interval
 * Examples:
 * [{size: 5}] show 5 items regardless
 * [{end: 992, size: 3}},{size: 4}] < 992 show 3 items, else show 4 items
 * [{end: 576, size: 1}, {start: 576, end: 992, size: 2}, {size: 3}] < 576 show 1, 576 - 992 show 2, else show 3
 *
 * These are the default responsive fallback, if you don't have a catch all, it will fallback to this.
 * [{end: 576, size: 1},
 * {start: 576, end: 768, size: 2},
 * {start: 768, end: 992, size: 3},
 * {start: 992, end: 1200, size: 4},
 * {start: 1200, size: 5}]
 */
options: {
  type: Object,
  required: false
}

Preview:

Mobile-friendly List Scroller For Vue - horizontal-list

Changelog:

07/22/2020

  • v1.0.12: Fixed falsely integer zero issue with babel nullish coalescing feature

Download Details:

Author: fuxingloh

Live Demo: https://nuxt-app.now.sh/vue-horizontal-list

Download Link: https://github.com/fuxingloh/vue-horizontal-list/archive/master.zip

Official Website: https://github.com/fuxingloh/vue-horizontal-list

Install & Download:

# Yarn
$ yarn add vue-horizontal-list

# NPM
$ npm install vue-horizontal-list --save

You Might Be Interested In:

Tags:

Add Comment