{"version":"6.3.3","name":"simplebar","title":"SimpleBar.js","description":"Scrollbars, simpler.","author":{"name":"Adrien Denat from a fork by Jonathan Nicol"},"repository":{"type":"git","url":"git+https://github.com/grsmto/simplebar.git","directory":"packages/simplebar"},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","unpkg":"./dist/simplebar.min.js","style":"./dist/simplebar.min.css","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"},"./dist/simplebar.css":"./dist/simplebar.css","./dist/simplebar.min.css":"./dist/simplebar.min.css"},"homepage":"https://grsmto.github.io/simplebar/","bugs":{"url":"https://github.com/grsmto/simplebar/issues"},"license":"MIT","scripts":{"build":"rollup -c && cp ../simplebar-core/src/simplebar.css dist/simplebar.css && minify dist/simplebar.css > dist/simplebar.min.css","dev":"rollup -c -w --environment BUILD:development","test":"jest -c jest-unit.config.js","version":"yarn build","precommit":"lint-staged"},"dependencies":{"simplebar-core":"^1.3.2"},"devDependencies":{"@babel/plugin-transform-runtime":"^7.19.6","intern":"^4.4.2","minify":"^3.0.5","promise":"^8.0.2"},"lint-staged":{"*.{js,jsx,json}":["prettier-eslint --write","git add"]},"gitHead":"dfbb9def64f3408b693859764922c454d1e86df9","_id":"simplebar@6.3.3","_nodeVersion":"22.18.0","_npmVersion":"lerna/6.4.1/node@v22.18.0+arm64 (darwin)","dist":{"integrity":"sha512-ni9cIiA8GRitiaenV7A/gh8nTStiVqO3gLxrfCMmq6CSy/pB+fz+QxqvJLo142QHb2Tvgvr8ILwZxf3qzAq7pg==","shasum":"08b4763e2a8e2b121f444fba613797a82ac33481","tarball":"http://registry-npm.ywwl.com/simplebar/download/simplebar-6.3.3.tgz","fileCount":12,"unpackedSize":211173,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIF9R87YD8ZgPmJWddss/TDzRJNSKJ2Q+UIEiZ7x9WYc3AiEA7TGX1dHTe9+UAoLJ5ijao1l13PRXOR9ikzZIKa8ZZfY="}],"size":42164,"noattachment":false,"key":"/simplebar/-/simplebar-6.3.3.tgz"},"_npmUser":{"name":"gromy","email":"oi@adriendenat.com"},"directories":{},"maintainers":[{"name":"gromy","email":"oi@adriendenat.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/simplebar_6.3.3_1762719270115_0.06582117593793213"},"_hasShrinkwrap":false,"readme":"# SimpleBar [![npm package][npm-badge]][npm] ![size-badge]\n\nSimpleBar is a plugin that tries to solve a long time problem: how to get custom scrollbars for your web-app while keeping a good user experience?\nSimpleBar **does NOT implement a custom scroll behaviour**. It keeps the **native** `overflow: auto` scroll and **only** replace the scrollbar visual appearance.\n\nSimpleBar is meant to be as easy to use as possible and lightweight. If you want something more advanced I recommend [KingSora](https://github.com/KingSora) 's [Overlay Scrollbars](https://kingsora.github.io/OverlayScrollbars/).\n\n- **🐦 Follow me on [Twitter!](https://twitter.com/adriendenat) or [Mastodon!](https://mas.to/@adrien)**\n- **👨‍💻 I'm available for hire! [Reach out to me!](https://adriendenat.com/)**\n- **🚧 Check out my new project [Scroll Snap Carousel](https://github.com/Grsmto/scroll-snap-carousel)!**\n\n### Installation\n\n**- Via npm**\n`npm install simplebar resize-observer-polyfill --save`\n\n**- Via Yarn**\n`yarn add simplebar resize-observer-polyfill`\n\n**- Via `<script>` tag**\n\n```html\n<link\n  rel=\"stylesheet\"\n  href=\"https://unpkg.com/simplebar@latest/dist/simplebar.css\"\n/>\n<script src=\"https://unpkg.com/simplebar@latest/dist/simplebar.min.js\"></script>\n<!-- or -->\n<link\n  rel=\"stylesheet\"\n  href=\"https://cdn.jsdelivr.net/npm/simplebar@latest/dist/simplebar.css\"\n/>\n<script src=\"https://cdn.jsdelivr.net/npm/simplebar@latest/dist/simplebar.min.js\"></script>\n```\n\nnote: you should replace `@latest` to the latest version (ex `@2.4.3`), if you want to lock to a specific version.\nYou can find the full list of modules available [there](https://unpkg.com/simplebar@latest/dist/).\n\n### Usage\n\nCheck out the [React](https://github.com/Grsmto/simplebar/blob/master/examples/react/src/App.js) and [Vue](https://github.com/Grsmto/simplebar/blob/master/examples/vue/src/App.vue) examples.\n\nIf you are using a module loader (like Webpack) you first need to load SimpleBar:\n\n```js\nimport 'simplebar'; // or \"import SimpleBar from 'simplebar';\" if you want to use it manually.\nimport 'simplebar/dist/simplebar.css';\n\n// You will need a ResizeObserver polyfill for browsers that don't support it! (iOS Safari, Edge, ...)\nimport ResizeObserver from 'resize-observer-polyfill';\nwindow.ResizeObserver = ResizeObserver;\n```\n\nYou might also need other polyfills as SimpleBar comes with basic browser support only.\nYou can use Babel `@babel/preset-env` to polyfill for you, see our [examples package](https://github.com/Grsmto/simplebar/blob/next/packages/examples/.babelrc#L2) or check out [polyfill.io](https://polyfill.io/).\n\nSet `data-simplebar` on the element you want your custom scrollbar. You're done.\n\n```html\n<div data-simplebar></div>\n```\n\n**Don't forget to import both css and js in your project!**\n\n### Noscript support\n\nTo make sure your elements are scrollable when JavaScript is disabled, it's important to include this snippet in your `<head>` to reset scrolling:\n\n```js\n<noscript>\n  <style>\n    /**\n    * Reinstate scrolling for non-JS clients\n    */\n    .simplebar-content-wrapper {\n      scrollbar-width: auto;\n      -ms-overflow-style: auto;\n    }\n\n    .simplebar-content-wrapper::-webkit-scrollbar,\n    .simplebar-hide-scrollbar::-webkit-scrollbar {\n      display: initial;\n      width: initial;\n      height: initial;\n    }\n  </style>\n</noscript>\n```\n\n### :warning: Warning!\n\nSimpleBar is **not intended to be used on the `body` element!** I don't recommend wrapping your entire web page inside a custom scroll as it will often badly affect the user experience (slower scroll performance compared to the native body scroll, no native scroll behaviours like click on track, etc.). Do it at your own risk! SimpleBar is meant to improve the experience of **internal web page scrolling**; such as a chat box or a small scrolling area. **Please read the [caveats](#5-caveats) section first to be aware of the limitations!**\n\n### Troubleshooting\n\nIf you are experiencing issues when setting up SimpleBar, it is most likely because your styles are clashing with SimpleBar ones. Make sure the element you are setting SimpleBar on does not override any SimpleBar css properties! **We recommend to not style that element at all and use an inner element instead.**\n\n### Sponsors\n\nThanks to BrowserStack for sponsoring open source projects and letting us test SimpleBar for free.\n<a href=\"https://www.browserstack.com\" target=\"_blank\">\n<img src=\"https://user-images.githubusercontent.com/15015324/45184727-368fbf80-b1fe-11e8-8827-08dbc80b0fb1.png\" width=\"200\">\n</a>\n\n---\n\n1. [Documentation](#1-documentation)\n2. [Browsers support](#2-browsers-support)\n3. [Demo](#3-demo)\n4. [How it works](#4-how-it-works)\n5. [Caveats](#5-caveats)\n6. [Changelog](#6-changelog)\n7. [Credits](#7-credits)\n\n## 1. Documentation\n\n### Other usages\n\nYou can start SimpleBar manually if you need to:\n\n```js\nnew SimpleBar(document.getElementById('myElement'));\n```\n\nor\n\n```js\nArray.prototype.forEach.call(\n  document.querySelectorAll('.myElements'),\n  (el) => new SimpleBar(el)\n);\n```\n\nIf you want to use jQuery:\n\n```js\nnew SimpleBar($('#myElement')[0]);\n```\n\nor\n\n```js\n$('.myElements').each((el) => new SimpleBar(el));\n```\n\n### Styling\n\nThe default styling is applied with CSS. There is no \"built-in\" way to style the scrollbar, you just need to override the default CSS.\n\nEx, to change the color of the scrollbar:\n\n```css\n.simplebar-scrollbar::before {\n  background-color: red;\n}\n```\n\n### Options\n\nOptions can be applied to the plugin during initialization:\n\n```js\nnew SimpleBar(document.getElementById('myElement'), {\n  option1: value1,\n  option2: value2,\n});\n```\n\nor using data-attributes:\n\n```html\n<div data-simplebar data-simplebar-auto-hide=\"false\"></div>\n```\n\nAvailable options are:\n\n#### autoHide\n\nBy default SimpleBar automatically hides the scrollbar if the user is not scrolling (it emulates Mac OSX Lion's scrollbar). You can make the scrollbar always visible by setting the `autoHide` option to `false`:\n\n```js\nnew SimpleBar(document.getElementById('myElement'), { autoHide: false });\n```\n\nDefault value is `true`.\n\nYou can also control the animation via CSS as it's a simple CSS opacity transition.\n\n#### scrollbarMinSize\n\nDefine the minimum scrollbar size in pixels.\n\nDefault value is `10`.\n\n#### classNames\n\nIt is possible to change the default class names that SimpleBar uses. To get your own styles to work refer to `simplebar.css` to get an idea how to setup your css.\n\n- `content` represents the wrapper for the content being scrolled.\n- `scrollContent` represents the container containing the elements being scrolled.\n- `scrollbar` defines the style of the scrollbar with which the user can interact to scroll the content.\n- `track` styles the area surrounding the `scrollbar`.\n\n```js\nclassNames: {\n  // defaults\n  content: 'simplebar-content',\n  scrollContent: 'simplebar-scroll-content',\n  scrollbar: 'simplebar-scrollbar',\n  track: 'simplebar-track'\n}\n```\n\n#### forceVisible\n\nYou can force the track to be visible (same behaviour as `overflow: scroll`) using the `forceVisible` option:\n\n```\nforceVisible: true|'x'|'y' (default to `false`)\n```\n\nBy default, SimpleBar behave like `overflow: auto`.\n\n#### direction (RTL support)\n\nYou can activate RTL support by passing the `direction` option:\n\n```\ndirection: 'rtl' (default to `ltr`)\n```\n\nYou will need both `data-simplebar-direction='rtl'` and a css rule with `direction: rtl`.\n\n#### timeout (deprecated)\n\nThis option is deprecated. You can now achieve this in CSS:\n\n```\n.simplebar-scrollbar:before {\n  transition-delay: 2s;\n}\n```\n\n#### clickOnTrack\n\nControls the click on track behaviour.\n\nDefault to `true`.\n\n#### scrollbarMinSize / scrollbarMaxSize\n\nControls the min and max size of the scrollbar in `px`.\n\nDefault for `scrollbarMinSize` is `25`.\nDefault for `scrollbarMaxSize` is `0` (no max size).\n\n#### ariaLabel\n\nSet custom aria-label attribute for users with screen reader.\n\nThe default value is `scrollable content`.\n\n#### tabIndex\n\ntabIndex to set for simplebar. Defaults to `0`.\n\n### Apply scroll vertically only\n\nSimply define in css `overflow-x: hidden` on your element.\n\n### Notifying the plugin of content changes\n\n#### Note: you shouldn't need to use these functions as SimpleBar takes care of that automatically. This is for advanced usage only.\n\nIf later on you dynamically modify your content, for instance changing its height or width, or adding or removing content, you should recalculate the scrollbars like so:\n\n```js\nconst simpleBar = new SimpleBar(document.getElementById('myElement'));\nsimpleBar.recalculate();\n```\n\n### Trigger programmatical scrolling\n\nIf you want to access to the original scroll element, you can retrieve it via a getter:\n\n```js\nconst simpleBar = new SimpleBar(document.getElementById('myElement'));\nsimpleBar.getScrollElement();\n```\n\n### Subscribe to `scroll` event\n\nYou can subscribe to the `scroll` event, just like you do with native scrolling elements:\n\n```js\nconst simpleBar = new SimpleBar(document.getElementById('myElement'));\nsimpleBar.getScrollElement().addEventListener('scroll', function(...));\n```\n\n### Add content dynamically\n\nYou can retrieve the element containing data like this:\n\n```js\nconst simpleBar = new SimpleBar(document.getElementById('myElement'));\nsimpleBar.getContentElement();\n```\n\n### Disable Mutation Observer (core package only)\n\n```js\nSimpleBar.removeObserver();\n```\n\n### Retrieve SimpleBar instance from data-simplebar nodes\n\n```js\nSimpleBar.instances.get(document.querySelector('[data-simplebar]']))\n```\n\n### Non-JS fallback\n\nSimpleBar hides the browser's default scrollbars, which obviously is undesirable if the user has JavaScript disabled. To restore the browser's scrollbars you can include the following `noscript` element in your document's `head`:\n\n```html\n<noscript>\n  <style>\n    [data-simplebar] {\n      overflow: auto;\n    }\n  </style>\n</noscript>\n```\n\n## 2. Browsers support\n\nSimpleBar has been tested on the following browsers: Chrome, Firefox, Safari, Edge, IE11.\n\nNotice: IE10 doesn't support `MutationObserver` so you will still need to instantiate SimpleBar manually and call `recalculate()` as needed (or you can just use a polyfill for `MutationObserver`).\n\nIf you want to apply SimpleBar on an SVG element on IE11, you will need a [polyfill for `classList`](https://github.com/eligrey/classList.js/blob/master/classList.js).\n\nIE9 is not supported anymore (because we use `translate3d` to position the scrollbar) so please use SimpleBar v1 if you really need it.\n\n## 3. Demo\n\nhttps://grsmto.github.io/simplebar/\n\n## 4. How it works\n\nSimpleBar only does one thing: replace the browser's default scrollbars with a custom CSS-styled scrollbar without sacrificing performance. Unlike most other plugins, SimpleBar doesn't mimic scroll behaviour with Javascript, which typically causes jank and strange scrolling behaviour. You keep the awesomeness of native scrolling… with a custom scrollbar!\nDesign your scrollbar how you like, with CSS, across all browsers.\n\nFor the most part SimpleBar uses the browser's native scrolling functionality, but replaces the conventional scrollbar with a custom CSS-styled scrollbar. The plugin listens for scroll events and redraws the custom scrollbar accordingly.\n\nKey to this technique is hiding the native browser scrollbar. The scrollable element is made slightly wider/taller than its containing element, effectively hiding the scrollbar from view.\n\n## 5. Caveats\n\n- SimpleBar can't be used on the `<body>`, `<textarea>`, `<table>` or `<iframe>` elements. If you are looking to support these, I suggest taking a look at [OverLayScrollbars](https://kingsora.github.io/OverlayScrollbars).\n- SimpleBar doesn't currently support `overflow: visible`. Which means any children of your scrolling div will be clipped (like with `overflow: hidden`).\n\nPlease take a look at [this comparison table](https://kingsora.github.io/OverlayScrollbars/#!faq) to see what SimpleBar does compare to others.\n\n### Community plugins\n\n**Ruby On Rails**\nTo include SimpleBar in the Ruby On Rails asset pipeline, use the [simplebar-rails](https://github.com/thutterer/simplebar-rails) gem.\n\n**Ember.js**\nTo use SimpleBar with the Ember.js framework, use the [ember-simplebars](https://github.com/fpauser/ember-simplebar) addon.\n\n[npm-badge]: https://img.shields.io/npm/v/simplebar.svg?style=flat-square\n[npm]: https://www.npmjs.org/package/simplebar\n[size-badge]: http://img.badgesize.io/Grsmto/simplebar/master/packages/simplebar/src/simplebar.js?compression=gzip&&style=flat-square\n","publish_time":1762719270297,"_cnpm_publish_time":1762719270297,"dist-tags":{"beta":"6.0.0-beta.12","corejs-2":"5.0.5-corejs2","latest":"6.3.3"}}