KingSora / OverlayScrollbars

A javascript scrollbar plugin that hides the native scrollbars, provides custom styleable overlay scrollbars, and preserves the native functionality and feel.
https://kingsora.github.io/OverlayScrollbars
MIT License
3.71k stars 215 forks source link

Is it possible to add plugin for react hook version of OS? #632

Closed Enkratia closed 2 months ago

Enkratia commented 2 months ago

I don't see any possibility to add plugin here: `useOverlayScrollbars({ options: osOptions, defer: true });

Question #2: OS react hook doesn't have option to set element, right?

KingSora commented 2 months ago

Good day @Enkratia :)

Adding plugins is not something thats specific to any framework. Plugins are global and should not be added in a component, instead they should be added in your entry point or somewhere in the global scope. You can add plugins like this:

import { OverlayScrollbars } from 'overlayscrollbars';

OverlayScrollbars.plugin(MyPlugin); 

The react hook has the possibility to attach OverlayScrollbars to any element. You can find an example of this in the README of the react version: https://github.com/KingSora/OverlayScrollbars/tree/master/packages/overlayscrollbars-react#hook