SimpleBar React Component

3.3.2 · active · verified Sun Apr 19

SimpleBar-React is a React wrapper component for the core SimpleBar library, which provides highly customizable scrollbars while preserving native browser scroll performance and behaviors. Unlike many other custom scrollbar solutions, it avoids JavaScript-driven scrolling in favor of native `overflow: auto`, ensuring a smooth user experience. The `simplebar-react` package is currently at version 3.3.2. The underlying `simplebar` core library is actively maintained, with version 6.2.7 being stable and a 7.0.0-beta.0 release in progress, indicating a consistent, though not rapid, release cadence for major updates. It is designed for internal scrolling areas (like chat boxes or specific content panels) and explicitly warns against use on the `document.body`. It ships with TypeScript definitions and supports modern React versions.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to integrate `SimpleBar` into a React component, showing a basic scrollable area with custom scrollbars and imported CSS.

import React from 'react';
import SimpleBar from 'simplebar-react';
import 'simplebar-react/dist/simplebar.min.css';

const MyScrollableContent = () => (
  <SimpleBar style={{ maxHeight: 300, border: '1px solid #ccc', padding: '10px' }}>
    <div style={{ paddingRight: '20px' }}>
      <p>This is some content that will eventually overflow the container.</p>
      <p>SimpleBar will provide a custom styled scrollbar for this area.</p>
      <p>It maintains native scrolling behavior for optimal performance.</p>
      <p>You can customize the appearance of the scrollbar using CSS variables.</p>
      <p>Remember not to use SimpleBar on the entire document body.</p>
      <p>More content to make it scrollable...</p>
      <p>Line 7</p>
      <p>Line 8</p>
      <p>Line 9</p>
      <p>Line 10</p>
      <p>Line 11</p>
      <p>Line 12</p>
      <p>Line 13</p>
      <p>Line 14</p>
      <p>Line 15</p>
      <p>Line 16</p>
      <p>Line 17</p>
      <p>Line 18</p>
      <p>Line 19</p>
      <p>Line 20</p>
    </div>
  </SimpleBar>
);

export default MyScrollableContent;

view raw JSON →