{"_id":"overlayscrollbars-react@0.5.7","bugs":{"url":"https://github.com/KingSora/OverlayScrollbars/issues"},"dist":{"shasum":"6434d5cc03004a6915fb9db67d6a382bb65c08ad","tarball":"http://registry-npm.ywwl.com/overlayscrollbars-react/download/overlayscrollbars-react-0.5.7.tgz","fileCount":18,"integrity":"sha512-pjWnZNmVkv4J0k/YzdazWJpBuu1mTTKR6K0pzjqK9BfHkB53hREqBGV8LONH23G5ulGXeXBLgD91HjcQuvq2WA==","signatures":[{"sig":"MEYCIQDm1ozLBuOBK7LLPt6vtRcPD7zfuT2AgshLuQCbbB04RwIhAO2sez3Ec4KiwlO6FFhKiCx9YGCoTR/ypAigVPqt4qg/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDqbmvKCeVcdkneIcijUxcxbxkPmwYk3cTkfahQP1Y/aQIhAI8WIe5KUgFEdZlAt1yUFLw71cEhRUH59QwqpRYc5xA8"}],"unpackedSize":82830,"size":12465,"noattachment":false,"key":"/overlayscrollbars-react/-/overlayscrollbars-react-0.5.7.tgz"},"main":"overlayscrollbars-react.cjs.js","name":"overlayscrollbars-react","types":"types/overlayscrollbars-react.d.ts","author":{"name":"Rene Haas | KingSora"},"module":"overlayscrollbars-react.esm.js","exports":{".":{"import":{"types":"./types/overlayscrollbars-react.d.mts","default":"./overlayscrollbars-react.mjs"},"default":{"types":"./types/overlayscrollbars-react.d.ts","default":"./overlayscrollbars-react.cjs.js"},"require":{"types":"./types/overlayscrollbars-react.d.cts","default":"./overlayscrollbars-react.cjs"}}},"gitHead":"33ea9eefd2c750b1bbd62fd4bbe3b1ec8efc6129","license":"MIT","version":"0.5.7","_npmUser":{"name":"kingsora","email":"king-sora@hotmail.de"},"homepage":"https://kingsora.github.io/OverlayScrollbars","keywords":["overlayscrollbars","react","component","hook","hooks","styleable","custom","scrollbar","scrollbars","scroll"],"repository":{"url":"git+https://github.com/KingSora/OverlayScrollbars.git","type":"git","directory":"packages/overlayscrollbars-react"},"_npmVersion":"11.19.0","description":"OverlayScrollbars for React.","directories":{},"maintainers":[{"name":"kingsora","email":"king-sora@hotmail.de"}],"sideEffects":false,"_nodeVersion":"24.20.0","_hasShrinkwrap":false,"peerDependencies":{"react":">=16.8.0","overlayscrollbars":"^2.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/overlayscrollbars-react_0.5.7_1792492199772_0.2864554236156438"},"readme":"<div align=\"center\">\r\n  <a href=\"https://kingsora.github.io/OverlayScrollbars\"><img src=\"https://raw.githubusercontent.com/KingSora/OverlayScrollbars/master/logo/logo.png\" width=\"160\" height=\"160\" alt=\"OverlayScrollbars\"></a>\r\n  <a href=\"https://reactjs.org\"><img src=\"https://raw.githubusercontent.com/KingSora/OverlayScrollbars/master/packages/overlayscrollbars-react/logo.svg\" width=\"160\" height=\"160\" alt=\"React\"></a>\r\n</div>\r\n<br />\r\n<div align=\"center\">\r\n\r\n  [![OverlayScrollbars](https://img.shields.io/badge/OverlayScrollbars-%5E2.0.0-338EFF?style=flat-square)](https://github.com/KingSora/OverlayScrollbars)\r\n  [![React](https://img.shields.io/badge/React-%3E=16.8.0-61DAFB?style=flat-square&logo=React)](https://github.com/facebook/react/)\r\n  [![Downloads](https://img.shields.io/npm/dt/overlayscrollbars-react.svg?style=flat-square)](https://www.npmjs.com/package/overlayscrollbars-react)\r\n  [![Version](https://img.shields.io/npm/v/overlayscrollbars-react.svg?style=flat-square)](https://www.npmjs.com/package/overlayscrollbars-react)\r\n  [![License](https://img.shields.io/github/license/kingsora/overlayscrollbars.svg?style=flat-square)](#)\r\n\r\n</div>\r\n<h3 align=\"center\">\r\n  <a href=\"https://kingsora.github.io/OverlayScrollbars\">Website</a>\r\n  &nbsp;&nbsp;&bull;&nbsp;&nbsp;\r\n  <a href=\"https://kingsora.github.io/OverlayScrollbars/examples\">Examples</a>\r\n</h3>\r\n\r\n# OverlayScrollbars for React\r\n\r\nThis is the official OverlayScrollbars React wrapper.\r\n\r\n## Installation\r\n\r\n```sh\r\nnpm install overlayscrollbars-react\r\n```\r\n\r\n## Peer Dependencies\r\n\r\nOverlayScrollbars for React has the following **peer dependencies**:\r\n\r\n- The vanilla JavaScript library: [overlayscrollbars](https://www.npmjs.com/package/overlayscrollbars)\r\n\r\n```\r\nnpm install overlayscrollbars\r\n```\r\n\r\n- The React framework: [react](https://www.npmjs.com/package/react)\r\n\r\n```\r\nnpm install react\r\n```\r\n\r\n## Usage\r\n\r\nThe first step is to import the CSS file into your app:\r\n```ts\r\nimport 'overlayscrollbars/overlayscrollbars.css';\r\n```\r\n\r\n> __Note__: If the path `'overlayscrollbars/overlayscrollbars.css'` is not working use `'overlayscrollbars/styles/overlayscrollbars.css'` as the import path for the CSS file.\r\n\r\n## Component\r\n\r\nThe main entry point is the `OverlayScrollbarsComponent` which can be used in your application as a component:\r\n\r\n```jsx\r\nimport { OverlayScrollbarsComponent } from \"overlayscrollbars-react\";\r\n\r\n// ...\r\n\r\n<OverlayScrollbarsComponent defer>\r\n  example content\r\n</OverlayScrollbarsComponent>\r\n```\r\n\r\n### Properties\r\n\r\nThe component accepts all properties of regular elements such as `div` and `span`.  \r\nAdditionally it has custom optional properties:\r\n\r\n- `element`: accepts a `string` which represents the tag of the root element.\r\n- `options`: accepts an `object` which represents the OverlayScrollbars options.\r\n- `events`: accepts an `object` which represents the OverlayScrollbars events.\r\n- `defer`: accepts an `boolean` or `object`. Defers the initialization to a point in time when the browser is idle.\r\n\r\n> __Note__: None of the properties has to be memoized.\r\n\r\n> __Note__: Its **highly recommended** to use the `defer` option whenever possible to defer the initialization to a browser's idle period.\r\n\r\n```jsx\r\n// example usage\r\n<OverlayScrollbarsComponent\r\n  element=\"span\"\r\n  options={{ scrollbars: { autoHide: 'scroll' } }}\r\n  events={{ scroll: () => { /* ... */ } }}\r\n  defer\r\n/>\r\n```\r\n\r\n### Ref\r\n\r\nThe `ref` of the `OverlayScrollbarsComponent` will give you an object with which you can access the OverlayScrollbars `instance` and the root `element` of the component.  \r\nThe ref object has two properties:\r\n\r\n- `osInstance`: a function which returns the OverlayScrollbars instance.\r\n- `getElement`: a function which returns the root element.\r\n\r\n## Hook\r\n\r\nIn case the `OverlayScrollbarsComponent` is not enough, you can also use the `useOverlayScrollbars` hook:\r\n\r\n```jsx\r\nimport { useOverlayScrollbars } from \"overlayscrollbars-react\";\r\n\r\n// example usage\r\nconst Component = () => {\r\n  const ref = useRef();\r\n  const [initialize, instance] = useOverlayScrollbars({ options, events, defer });\r\n  \r\n  useEffect(() => {\r\n    initialize(ref.current);\r\n  }, [initialize]);\r\n  \r\n  return <div ref={ref} />\r\n}\r\n```\r\n\r\nThe hook is for advanced usage and lets you control the whole initialization process. This is useful if you want to integrate it with other plugins such as `react-window` or `react-virtualized`.\r\n\r\nThe hook will destroy the instance automatically if the component unmounts.\r\n\r\n### Parameters\r\n\r\nParameters are optional and similar to the `OverlayScrollbarsComponent`.\r\nIts an `object` with optional properties:\r\n\r\n- `options`: accepts an `object` which represents the OverlayScrollbars options.\r\n- `events`: accepts an `object` which represents the OverlayScrollbars events.\r\n- `defer`: accepts an `boolean` or `object`. Defers the initialization to a point in time when the browser is idle.\r\n\r\n### Return\r\n\r\nThe `useOverlayScrollbars` hook returns a `tuple` with two values:\r\n\r\n- The first value is the `initialization` function, it takes one argument which is the `InitializationTarget`.\r\n- The second value is a function which returns the current OverlayScrollbars instance or `null` if not initialized.\r\n\r\n> __Note__: The identity of both functions is stable and won't change, thus they can safely be used in any dependency array.\r\n\r\n## License\r\n\r\nMIT\r\n","publish_time":1792492199858,"_cnpm_publish_time":1792492199858,"dist-tags":{"latest":"0.5.7"}}