{"id":16487187,"url":"https://github.com/shawnmcknight/react-scrollbar-size","last_synced_at":"2025-05-12T04:30:33.997Z","repository":{"id":37046870,"uuid":"86180990","full_name":"shawnmcknight/react-scrollbar-size","owner":"shawnmcknight","description":"React hook to calculate the size of browser scrollbars.","archived":false,"fork":false,"pushed_at":"2023-11-13T19:41:16.000Z","size":11466,"stargazers_count":28,"open_issues_count":15,"forks_count":12,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T21:03:24.114Z","etag":null,"topics":["react","scrollbar"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shawnmcknight.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-25T18:50:34.000Z","updated_at":"2024-06-13T09:54:23.000Z","dependencies_parsed_at":"2023-10-02T22:56:53.112Z","dependency_job_id":"92ac7868-6cb2-4781-b0ac-3ecbc749c7f5","html_url":"https://github.com/shawnmcknight/react-scrollbar-size","commit_stats":{"total_commits":796,"total_committers":8,"mean_commits":99.5,"dds":0.5125628140703518,"last_synced_commit":"1e0a76fd78d6e0951666f5a2a17b7fd000879a56"},"previous_names":["storis/react-scrollbar-size"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnmcknight%2Freact-scrollbar-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnmcknight%2Freact-scrollbar-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnmcknight%2Freact-scrollbar-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shawnmcknight%2Freact-scrollbar-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shawnmcknight","download_url":"https://codeload.github.com/shawnmcknight/react-scrollbar-size/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253675062,"owners_count":21945890,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react","scrollbar"],"created_at":"2024-10-11T13:33:05.091Z","updated_at":"2025-05-12T04:30:33.401Z","avatar_url":"https://github.com/shawnmcknight.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React-Scrollbar-Size\n\n\u003cdiv align=\"center\"\u003e\n\nReact-Scrollbar-Size is a [React](https://reactjs.org/) hook designed to calculate the size of the user agent's horizontal and vertical scrollbars.\nIt will also detect when the size of the scrollbars change, such as when the user agent's zoom factor changes.\n\n[![npm package](https://img.shields.io/npm/v/react-scrollbar-size/latest.svg)](https://www.npmjs.com/package/react-scrollbar-size)\n[![npm downloads](https://img.shields.io/npm/dm/react-scrollbar-size)](https://www.npmjs.com/package/react-scrollbar-size)\n[![CircleCI](https://circleci.com/gh/shawnmcknight/react-scrollbar-size.svg?style=shield)](https://circleci.com/gh/shawnmcknight/react-scrollbar-size/tree/main)\n[![Code Climate](https://img.shields.io/codeclimate/maintainability/shawnmcknight/react-scrollbar-size)](https://codeclimate.com/github/shawnmcknight/react-scrollbar-size)\n[![Code Style](https://badgen.net/badge/eslint/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)\n[![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/)\n[![Dependencies](https://img.shields.io/librariesio/release/npm/react-scrollbar-size)](https://libraries.io/npm/react-scrollbar-size)\n[![Percentage of issues still open](https://isitmaintained.com/badge/open/shawnmcknight/react-scrollbar-size.svg)](https://isitmaintained.com/project/shawnmcknight/react-scrollbar-size)\n![License](https://img.shields.io/npm/l/react-scrollbar-size)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)\n[![Star on Github](https://img.shields.io/github/stars/shawnmcknight/react-scrollbar-size?style=social)](https://github.com/shawnmcknight/react-scrollbar-size)\n\n\u003c/div\u003e\n\n## Installation\n\nReact-Scrollbar-Size is available as an [npm package](https://www.npmjs.com/package/react-scrollbar-size):\n\n```sh\n$ npm install react-scrollbar-size\n```\n\n## Usage\n\nThe `useScrollbarSize` custom hook returns an object with two properties:\n\n| Name     | Description                                    |\n| -------- | ---------------------------------------------- |\n| `width`  | The current width of the vertical scrollbar    |\n| `height` | The current height of the horizontal scrollbar |\n\n## Examples\n\nTo see a live example, follow these [instructions](/example/README.md).\n\n### TypeScript\n\n```tsx\nimport { CSSProperties, FunctionComponent } from 'react';\nimport useScrollbarSize from 'react-scrollbar-size';\n\nconst styles: CSSProperties = {\n  margin: '1rem',\n  textAlign: 'center',\n};\n\nconst ScrollbarSizeDemo: FunctionComponent = () =\u003e {\n  const { height, width } = useScrollbarSize();\n\n  return (\n    \u003cdiv style={styles}\u003e\n      \u003ch2\u003eReact Scrollbar Size Demo\u003c/h2\u003e\n      \u003ch4\u003eTip: Change browser zoom level to see scrollbar sizes change.\u003c/h4\u003e\n      \u003cp\u003e\n        The current height of the scrollbar is {height}px.\n        \u003cbr /\u003e\n        The current width of the scrollbar is {width}px.\n      \u003c/p\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n### JavaScript\n\n```jsx\nimport useScrollbarSize from 'react-scrollbar-size';\n\nconst styles = {\n  margin: '1rem',\n  textAlign: 'center',\n};\n\nconst ScrollbarSizeDemo = () =\u003e {\n  const { height, width } = useScrollbarSize();\n\n  return (\n    \u003cdiv style={styles}\u003e\n      \u003ch2\u003eReact Scrollbar Size Demo\u003c/h2\u003e\n      \u003ch4\u003eTip: Change browser zoom level to see scrollbar sizes change.\u003c/h4\u003e\n      \u003cp\u003e\n        The current height of the scrollbar is {height}px.\n        \u003cbr /\u003e\n        The current width of the scrollbar is {width}px.\n      \u003c/p\u003e\n    \u003c/div\u003e\n  );\n};\n```\n\n## License\n\nThis project is licensed under the terms of the\n[MIT license](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawnmcknight%2Freact-scrollbar-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshawnmcknight%2Freact-scrollbar-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshawnmcknight%2Freact-scrollbar-size/lists"}