New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

smooth-scrollbar-react

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smooth-scrollbar-react

A wrapper for smooth-scrollbar to React Component

Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

SMOOTH-SCROLLBAR-REACT

A wrapper for smooth-scrollbar to React Component.

NPM version NPM yearly download

Demo

http://smooth-scrollbar-react.surge.sh

Installation

To install the stable version you can use:

$ yarn add smooth-scrollbar-react

Usage

import Scrollbar from 'smooth-scrollbar-react';
<Scrollbar
    damping={number},
    thumbMinSize={number},
    syncCallbacks={boolean},
    renderByPixels={boolean},
    alwaysShowTracks={boolean},
    continuousScrolling={boolean},
    wheelEventTarget={element},
    plugins={object},
    onScroll={func},
>
  your contents here...
</Scrollbar>

Available Options

parametertypedefaultdescription
dampingnumber0.1Momentum reduction damping factor, a float value between (0, 1). The lower the value is, the more smooth the scrolling will be (also the more paint frames).
thumbMinSizenumber20Minimal size for scrollbar thumbs.
renderByPixelsbooleantrueRender every frame in integer pixel values, set to true to improve scrolling performance.
alwaysShowTracksbooleanfalseKeep scrollbar tracks visible.
continuousScrollingbooleantrueSet to true to allow outer scrollbars continue scrolling when current scrollbar reaches edge.
pluginsobject{}Options for plugins, see Plugin System.

Confusing with the option field? Try edit tool here!

Examples

Original code:

...
render() {
  return
  <div className="App">
    <div className="list-data">
      {[...Array(20).keys()]
        .map((value, index) => <div key={index}>{value + index}</div>)}
    </div>
  </div>
}
...

Option 1:

  import Scrollbar from 'smooth-scrollbar-react';

  ...
  render() {
    return
    <div className="App">
      <Scrollbar>
        <div
          className="list-data"
          style={{ height: '200px' }}
        >
          {[...Array(20).keys()]
            .map((value, index) => <div key={index}>{value + index}</div>)}
        </div>
      </Scrollbar>
    </div>
  }
  ...

Option 2: Recommended(Using display: flex)

  import Scrollbar from 'smooth-scrollbar-react';

  ...
  render() {
    return
    <div className="App">
      <div className="list-data" style={{ display: 'flex', maxHeight: '200px' }}>
        <Scrollbar>
          {[...Array(20).keys()]
            .map((value, index) => <div key={index}>{value + index}</div>)}
        </Scrollbar>
      </div>
    </div>
  }
  ...

License

MIT © Nghiep

Keywords

react

FAQs

Package last updated on 20 Jan 2021

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