@utilityjs/use-get-scrollbar-width
v1.0.1
Published
A React hook that calculates the width of the user agent's scrollbar.
Downloads
19
Maintainers
Readme
A React hook that calculates the width of the user agent's scrollbar.
npm i @utilityjs/use-get-scrollbar-width | yarn add @utilityjs/use-get-scrollbar-width
Usage
const App: React.FC = () => {
const getScrollbarWidth = useGetScrollbarWidth();
return (
<div className="app">
<button onClick={() => void console.log(getScrollbarWidth())}>Log Scrollbar Width</button>
</div>
);
};
API
useGetScrollbarWidth()
declare const useGetScrollbarWidth: (): (() => number);