@utilityjs/use-get-scrollbar-width
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

useGetScrollbarWidth

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

Package Sidebar

Install

npm i @utilityjs/use-get-scrollbar-width

Weekly Downloads

35

Version

1.0.1

License

MIT

Unpacked Size

5.62 kB

Total Files

8

Last publish

Collaborators

  • mimshins