Skip to main content

useScrollbarWidth

  • This is a hook that retrieves the width of the globally set scrollbar in the browser window.

Features

  • You can retrieve the width of the scrollbar.

Types

const useScrollbarWidth: () => number;

Example

const TableCols = (/**...**/) => {
const scrollbarWidth = useScrollbarWidth();

return (
// ...
<th style={{ width: `${scrollbarWidth}px` }} />
)
};