A minimalistic yet powerful Vue.js wrapper for [Perfect Scrollbar](https://perfectscrollbar.com/).
``sh`
npm install vue3-perfect-scrollbar
`sh`
yarn add vue3-perfect-scrollbar
sh
pnpm add vue3-perfect-scrollbar
`🔌 How to Use
$3
Integrate vue3-perfect-scrollbar globally in your main application file:
`js
import { createApp } from 'vue';
import { PerfectScrollbarPlugin } from 'vue3-perfect-scrollbar';
import 'vue3-perfect-scrollbar/style.css';
import App from './App.vue';createApp(App).use(PerfectScrollbarPlugin).mount('#app');
`Now, you can leverage the plugin in any component:
`html
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
... and much more content
`Customize the container height as needed:
`css
/ example /
.ps {
height: 400px; / or max-height: 400px; /
}
`$3
The install method accepts additional parameters:
`js
app.use(PerfectScrollbarPlugin, {
componentName: 'Scrollbar'
});
`####
componentName {String}
The name of your global component.Default:
PerfectScrollbar$3
For local registration, import and declare the component within your Vue component file:`html
content
`⚙️ Props
Customize the Perfect Scrollbar with the following props:
`ts
tag?: string;
options?: PerfectScrollbar.Options;
`####
tag? {String}
The tag that will be rendered as the Perfect Scrollbar container.Default:
div####
options? {PerfectScrollbar.Options}: Options
Options for the Perfect Scrollbar library.Explore Perfect Scrollbar options for further customization.
`ts
handlers?: string[];
maxScrollbarLength?: number;
minScrollbarLength?: number;
scrollingThreshold?: number;
scrollXMarginOffset?: number;
scrollYMarginOffset?: number;
suppressScrollX?: boolean;
suppressScrollY?: boolean;
swipeEasing?: boolean;
useBothWheelAxes?: boolean;
wheelPropagation?: boolean;
wheelSpeed?: number;
`🔄 Events
You can listen to all Perfect Scrollbar events.
Listen to all Perfect Scrollbar events. For a comprehensive list of events, visit Perfect Scrollbar events.
Example
`html
content
`$3
`ts
'scroll',
'ps-scroll-y',
'ps-scroll-x',
'ps-scroll-up',
'ps-scroll-down',
'ps-scroll-left',
'ps-scroll-right',
'ps-y-reach-start',
'ps-y-reach-end',
'ps-x-reach-start',
'ps-x-reach-end'
`🧩 Access to PerfectScrollbar Instance.
To gain direct access to the Perfect Scrollbar instance and leverage its API within your Vue component, you can use the ref attribute.
content
🔌 Use with Nuxt
Add to your
nuxt.config.ts:`ts
export default defineNuxtConfig({
modules: ['vue3-perfect-scrollbar/nuxt']
});
``+ If it's about the vue3-perfect-scrollbar wrapper (like how it works with Vue, or issues with props and events), please report these bugs on our vue3-perfect-scrollbar GitHub repo.
+ If the bug is with the Perfect Scrollbar itself (like problems with how it scrolls or looks), you should report it to the official Perfect Scrollbar repo. Remember, vue3-perfect-scrollbar is just a wrapper to make Perfect Scrollbar work with Vue. It doesn't change how Perfect Scrollbar works. So, if there's something wrong with the scrollbar behavior, the Perfect Scrollbar team needs to know.