An util component for react to create a responsive scrollable area with customizable scrollbar.
npm install react-responsive-scrollboxAn util component for react to create a responsive scrollable area with customizable scrollbar.
1. React version should be above 16.8.0.
```
npm install --save react-responsive-scrollbox
`jsx
import ScrollBox from "react-responsive-scrollbox";
// Just wrap the content.
`
The ScrollBox will responsively take up all the space of its parent element by default (width: 100%, height: 100%). You can change this behavior by adding additional styles:
1. use style prop.
`jsx`
2. use CSS class.
`css`
.addtional-style {
width: 200px;
height: 300px;
}
`jsx`
Every item of the scrollbar in ScrollBox has its own CSS class name, so you can use CSS selector to choose and customize the item you want.
| Item | CSS selector |
| -------------------------- | ------------------------------ |
| all scrollbar track | .scroll-box-track |.scroll-box-track.vertical
| vertical scrollbar track | |.scroll-box-track.horizontal
| horizontal scrollbar track | |.scroll-box-thumb
| all scrollbar thumb | |.scroll-box-thumb.vertical
| vertical scrollbar thumb | |.scroll-box-thumb.horizontal
| horizontal scrollbar thumb | |
For example, if you want to change the background color of vertical scrollbar track to green:
`css`
.green-bg .scroll-box-track.vertical {
background-color: green;
}
`jsx``