Gathering detailed insights and metrics for react-smooth-scrollbar
Gathering detailed insights and metrics for react-smooth-scrollbar
Gathering detailed insights and metrics for react-smooth-scrollbar
Gathering detailed insights and metrics for react-smooth-scrollbar
npm install react-smooth-scrollbar
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
150 Stars
116 Commits
19 Forks
4 Watching
3 Branches
6 Contributors
Updated on 12 Jul 2024
Minified
Minified + Gzipped
JavaScript (86.09%)
CSS (9.24%)
HTML (4.67%)
Cumulative downloads
Total Downloads
Last day
-33.5%
508
Compared to previous day
Last week
-16.2%
2,745
Compared to previous week
Last month
-10.6%
13,329
Compared to previous month
Last year
-18.6%
180,130
Compared to previous year
3
smooth-scrollbar for react projects.
React 0.14+
npm install react-smooth-scrollbar smooth-scrollbar --save
http://idiotwu.github.io/react-smooth-scrollbar/
1import React from 'react'; 2import ReactDOM from 'react-dom'; 3import Scrollbar from 'react-smooth-scrollbar'; 4 5class App extends React.Component { 6 render() { 7 return ( 8 <Scrollbar 9 damping={number} 10 thumbMinSize={number} 11 syncCallbacks={boolean} 12 renderByPixels={boolean} 13 alwaysShowTracks={boolean} 14 continuousScrolling={boolean} 15 wheelEventTarget={element} 16 plugins={object} 17 onScroll={func} 18 > 19 your contents here... 20 </Scrollbar> 21 ); 22 } 23} 24 25ReactDOM.render(<App />, document.body);
parameter | type | default | description |
---|---|---|---|
damping | number | 0.1 | Momentum 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). |
thumbMinSize | number | 20 | Minimal size for scrollbar thumbs. |
renderByPixels | boolean | true | Render every frame in integer pixel values, set to true to improve scrolling performance. |
alwaysShowTracks | boolean | false | Keep scrollbar tracks visible. |
continuousScrolling | boolean | true | Set to true to allow outer scrollbars continue scrolling when current scrollbar reaches edge. |
wheelEventTarget | EventTarget | null | Element to be used as a listener for mouse wheel scroll events. By default, the container element is used. This option will be useful for dealing with fixed elements. |
plugins | object | {} | Options for plugins, see Plugin System. |
Confusing with the option field? Try edit tool here!
1import { Component } from 'react'; 2import PropTypes from 'prop-types'; 3import SmoothScrollbar from 'smooth-scrollbar'; 4import OverscrollPlugin from 'smooth-scrollbar/plugins/overscroll'; 5import Scrollbar from 'react-smooth-scrollbar'; 6 7SmoothScrollbar.use(OverscrollPlugin); 8 9class App2 extends Component { 10 render() { 11 return ( 12 <Scrollbar> ... </Scrollbar> 13 ); 14 } 15}
Use ref
in parent component:
1class Parent extends React.Component { 2 componentDidMount() { 3 const { scrollbar } = this.$container; 4 } 5 6 render() { 7 return ( 8 <Scrollbar ref={c => this.$container = c}> 9 your content... 10 </Scrollbar> 11 ); 12 } 13}
Use Context
in child component:
1class Child extends React.Component { 2 static contextTypes = { 3 getScrollbar: React.PropTypes.func 4 }; 5 6 componentDidMount() { 7 this.context.getScrollbar((scrollbar) => { 8 // ... 9 }); 10 } 11 12 render() { 13 return <div> this is child component. </div>; 14 } 15} 16 17class App extends React.Component { 18 render(){ 19 return ( 20 <Scrollbar> 21 <Child /> 22 </Scrollbar> 23 ); 24 } 25}
MIT.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
83 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More