React-Scrollbar-Size
React-Scrollbar-Size is a React hook designed to calculate the size of the user agent's horizontal and vertical scrollbars. It will also detect when the size of the scrollbars change, such as when the user agent's zoom factor changes.
Installation
React-Scrollbar-Size is available as an npm package:
Usage
The useScrollbarSize
custom hook returns an object with two properties:
Name | Description |
---|---|
width |
The current width of the vertical scrollbar |
height |
The current height of the horizontal scrollbar |
Examples
To see a live example, follow these instructions.
TypeScript
JavaScript
License
This project is licensed under the terms of the
[MIT license].