1.0.1 • Published 3 years ago

@utilityjs/use-get-scrollbar-width v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

A React hook that calculates the width of the user agent's scrollbar.

license npm latest package npm downloads types

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);