Scrollbar

January 23, 2026 ยท View on GitHub

Scrollbar is used for displaying custom scrollbar

Usage

import {Scrollbar} from "@docspace/ui-kit/components";

Basic usage:

<Scrollbar>Some content</Scrollbar>

Examples

Basic scrollable content:

<Scrollbar>
  <div style={{ height: "500px" }}>
    <p>Scrollable content here...</p>
  </div>
</Scrollbar>

Custom styling:

<Scrollbar
  className="custom-scrollbar"
  scrollClass="scroll-area"
  style={{ height: "300px", width: "100%" }}
>
  <div>Content with custom styling</div>
</Scrollbar>

Horizontal scroll only:

<Scrollbar
  noScrollY={true}
  style={{ width: "300px" }}
>
  <div style={{ display: "flex", width: "1000px" }}>
    <div>Item 1</div>
    <div>Item 2</div>
    <div>Item 3</div>
  </div>
</Scrollbar>

With scroll event handling:

<Scrollbar
  autoHide={false}
  onScroll={(e) => {
    console.log("Scroll position:", e.currentTarget.scrollTop);
  }}
>
  <div style={{ height: "400px" }}>
    Scrollable content with event handling
  </div>
</Scrollbar>

Fixed size scrollbar with padding:

<Scrollbar
  fixedSize={true}
  paddingAfterLastItem="20px"
  style={{ height: "200px" }}
>
  <div>
    Content with fixed size scrollbar and bottom padding
  </div>
</Scrollbar>

Properties

PropsTypeRequiredValuesDefaultDescription
classNamestring---Accepts class
idstring---Accepts id
styleobj, array---Accepts css style
scrollClassstring---Scroll area class
autoHideboolean--trueEnable tracks auto hiding
fixedSizeboolean--falseFix scrollbar size
autoFocusboolean--falseFocus on content after render
tabIndexnumber|null---Scroll body tabindex
paddingAfterLastItemstring---Padding bottom to scroll-body
onScrollfunction---Scroll event handler
noScrollYboolean---Disable vertical scroll
noScrollXboolean---Disable horizontal scroll