Overview of SimpleBar
masteroverflow: auto scrolling and only replaces the visual appearance of the scrollbar. This ensures native scrolling performance and behavior.repository·master·Indexed 27 days ago
https://github.com/grsmto/simplebarA lightweight (6kb minified) library that replaces default browser scrollbars with customizable CSS-styled ones while preserving native scrolling performance. Includes a vanilla JavaScript plugin and official framework integrations for React (simplebar-react), Angular (simplebar-angular), and Vue (simplebar-vue).
overflow: auto scrolling and only replaces the visual appearance of the scrollbar. This ensures native scrolling performance and behavior.simplebar-react package using npm or Yarn.simplebar-core package is the internal core library and is not intended for direct use by end-users. If you want to use the vanilla JavaScript plugin, you should use the main simplebar package instead.To use the dependency-free version of SimpleBar, install it using npm.
npm install simplebarFor quick integration without a module bundler, you can include SimpleBar via <script> and <link> tags using unpkg or jsdelivr. It is recommended to replace @latest with a specific version to ensure stability.
<link
rel="stylesheet"
href="https://unpkg.com/simplebar@latest/dist/simplebar.css"
/>
<script src="https://unpkg.com/simplebar@latest/dist/simplebar.min.js"></script>
<!-- or -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/simplebar@latest/dist/simplebar.css"
/>
<script src="https://cdn.jsdelivr.net/npm/simplebar@latest/dist/simplebar.min.js"></script>If you are working within specific web frameworks, use these community plugins:
simplebar-rails gem.ember-simplebars addon.resize-observer-polyfill via npm or Yarn. The polyfill is necessary for browsers that do not natively support ResizeObserver (e.g., older iOS Safari or Edge).To use SimpleBar in your Vue project, you must register the component and import the required CSS. Ensure you import both the JavaScript component and the simplebar.min.css file.
import simplebar from 'simplebar-vue';
import 'simplebar-vue/dist/simplebar.min.css';
export default {
components: {
simplebar,
},
};To ensure elements remain scrollable when JavaScript is disabled, include this <noscript> block in your <head> to restore native scrolling styles.
<noscript>
<style>
[data-simplebar] {
overflow: auto;
}
.simplebar-content-wrapper {
scrollbar-width: auto;
-ms-overflow-style: auto;
}
.simplebar-content-wrapper::-webkit-scrollbar,
.simplebar-hide-scrollbar::-webkit-scrollbar {
display: initial;
width: initial;
height: initial;
}
</style>
</noscript>SimpleBar provides official support and documentation for several popular frameworks:
simplebar-reactsimplebar-angularsimplebar-vueSimpleBar does not have built-in styling options; you must override its default CSS classes to change the appearance.
/* Example: Change scrollbar color */
.simplebar-scrollbar::before {
background-color: red;
}You can install the simplebar-vue package using npm or Yarn.
npm install simplebar-vue --save
# or
yarn add simplebar-vue