Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

overlayscrollbars-react-better

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

overlayscrollbars-react-better

OverlayScrollbars wrapper for React.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

React OverlayScrollbars

React OverlayScrollbars Downloads License

Example   •   Documentation   •   FAQ

The official OverlayScrollbars wrapper for React.

Installation

npm install overlayscrollbars-react

Peer Dependencies

OverlayScrollbars for React has the following peer dependencies:

  • The vanilla JavaScript library: overlayscrollbars
npm install overlayscrollbars
  • The React framework: react
npm install react

TypeScript

npm install @types/overlayscrollbars

Since this wrapper is written in TypeScript it comes with its generated typings.
Check out the recommended tsconfig.json options.

Usage

CSS

You have to import the OverlayScrollbars.css by yourself.
The component doesn't do it for you as the styles are global styles!
There are different ways to achieve this, in React the most simple way for me was to add this line in the index file:

import 'overlayscrollbars/css/OverlayScrollbars.css';
Import

Simply import the component into your file(s):

import { OverlayScrollbarsComponent } from 'overlayscrollbars-react';
Template

After the import you can use it in JSX:

<OverlayScrollbarsComponent>
  example content
</OverlayScrollbarsComponent>
Properties

Two properties are accepted: options and extensions.

  • The options property accepts a object and can be changed at any point in time, and the plugin will adapt.
  • The extensions property accepts a string, string array or object and is only taken into account if the component gets mounted.
<OverlayScrollbarsComponent
  options={{ scrollbars: { autoHide: 'scroll' } }} 
  extensions={['extensionA', 'extensionB']}
>
</OverlayScrollbarsComponent>

You can read more about the options object here, extensions are documented here and here.

Instance

If you get the component reference, it provides two methods: osInstance() and osTarget().

  • The osInstance() method returns the OverlayScrollbars instance of the component, or null if the instance isn't initialized yet or already destroyed.
  • The osTarget() method returns the native html element to which the plugin was initialized, or null if the the component isn't mounted yet or already unmounted.

Example App

In case you need a example app for reference, you can use the example app in this repo(example folder):

If you wanna build the example app, run these commands:

npm run setup
npm run build
npm run example

License

MIT

Keywords

FAQs

Package last updated on 06 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc