vue-simplebar

Vue.js wrapper for simplebar
7,007 9
Install
npm install vue-simplebar
Latest Version:2.3.0
Older releases:2
License:MIT
Last Updated:Jul 11, 2023
Links: GitHub  ·  npm
Maintainer: hfalucas

Vue Simplebar

Vue.js wrapper for simplebar

Why would you use it ?

First, because custom scrollbars can be very frustrating and you want to add simplebar to your Vue project in an easy way, with the bonus of having some useful scroll events and helper methods out of the box.

Install

npm

npm install vue-simplebar

yarn

yarn add vue-simplebar

How to use

Global Registration

You can import and register the plugin in the entry point of your application like so:

import VueSimplebar from 'vue-simplebar'
import 'vue-simplebar/dist/vue-simplebar.min.css'

Vue.use(VueSimplebar)

Then use it like any other component:

<vue-simplebar>
    <p> Your scrollable content goes here </p>
</vue-simplebar>

Global options

Install method takes additional parameters:

name {String}

Name of your global component.

Default: VueSimplebar

tag {String}

Tag which will be render as simplebar container

Default: section

options {Object}: Options

simplebar options.

Default: {}

Local Registration

<template>
    <vue-simplebar>
        <p> Your scrollable content goes here. </p>
    </vue-simplebar>
</template>

<script>
import { VueSimplebar } from 'vue-simplebar'
export default {
    components: { VueSimplebar }
}
</script>
<style src="vue-simplebar/dist/vue-simplebar.min.css"/>

Props

tag {String}

Tag which will be render as simplebar container

Default: section

options {Object}: Options

simplebar options.

Events

This wrapper comes with some event helpers.

scroll-x-reach-start

This event fires when scrolling reaches the start of the x-axis.

scroll-x-reach-end

This event fires when scrolling reaches the end of the x-axis.

<vue-simplebar @scroll-x-reach-start="" @scroll-x-reach-end="">
    <p> Your scrollable content goes here. </p>
</vue-simplebar>

scroll-y-reach-start

This event fires when scrolling reaches the start of the y-axis (useful for a chat like pagination).

scroll-y-reach-end

This event fires when scrolling reaches the end of the y-axis (useful for infinite scroll).

<vue-simplebar @scroll-y-reach-start="" @scroll-y-reach-end="">
    <p> Your scrollable content goes here. </p>
</vue-simplebar>

Contribution

If you have any reasonable PR you are welcome.

License

MIT

Related Packages

easyscroll

this is a tiny scroll bar plugin for vue2.0

871 41
vue-dragscroll

vue directive to make a scrollable element scroll by draging to the scroll direc...

1,541,547 264
vue3-smooth-scroll

Simple vue smooth scroll

209,775 34
vue2-smooth-scroll

Simple vue smooth scroll

127,387 121
v-smooth-scroll

Simple vue smooth scroll

65,632 19

Version History

Version Released Vue License
2.3.0 MIT
2.0.0 MIT
1.1.0 ^2.5.17 MIT
1.0.0 ^2.5.17 MIT
0.1.3 ^2.5.17 MIT
Pre-releases (1)
Version Released Vue License
1.0.0-beta.1 ^2.5.17 MIT