📅  最后修改于: 2023-12-03 14:44:59.210000             🧑  作者: Mango
Overlayscrollbars-react is a lightweight and customizable scrollbar library written in TypeScript for React. It provides smooth and cross-browser scrolling experience and eliminates ugly default scrollbars.
Using npm:
npm install overlayscrollbars-react
Or with yarn:
yarn add overlayscrollbars-react
import OverlayScrollbars from 'overlayscrollbars-react';
<OverlayScrollbars>
{/* Scrollable Content */}
</OverlayScrollbars>
<OverlayScrollbars
options={{
className: 'my-scrollbar',
scrollbars: {
visibility: 'auto',
autoHide: 'move',
autoHideDelay: 800,
dragScrolling: true,
clickScrolling: false,
touchSupport: true,
},
}}
>
{/* Scrollable Content */}
</OverlayScrollbars>
<OverlayScrollbars
options={{
snap: {
step: 100,
easing: 'easeOutBounce',
},
}}
>
{/* Scrollable Content */}
</OverlayScrollbars>
<OverlayScrollbars
options={{
autoUpdate: true,
overflowBehavior: {
x: 'hidden',
y: 'scroll',
},
scrollbars: {
autoHide: 'never',
clickScrolling: false,
dragScrolling: true,
touchSupport: true,
},
}}
>
{/* Scrollable Content */}
</OverlayScrollbars>
Overlayscrollbars-react is a great scrollbar library for React developers searching for a lightweight and customizable alternative to default scrollbars. This library has many features such as scroll snapping, touch gestures, and cross-browser compatibility which make it a great choice for your next project.