Skip to content

Scrollbar ​

Brief Introduction ​

The Scrollbar component provides scrolling functionality when content exceeds the container bounds. You can use <MYScrollbar></MYScrollbar> or <MYScrollbar /> to implement a scrollbar.

Using Local Scrollbar ​

Both Horizontal and Vertical Scrollbars ​

Enable both horizontal and vertical scrollbars with corner connection:

Code Demo
11111111111111111111111111111
展开代码

Scrollbar Colors ​

Customize the thumb, track, and hover colors:

Code Demo
111111
展开代码

Disable Scrolling ​

Disable the scrolling functionality:

Code Demo
222222
展开代码

Set Max Height ​

Set the maximum height to 800px:

Code Demo
333333
展开代码

Combined Usage ​

Combine multiple props:

Code Demo
444444
展开代码

API Reference ​

Props ​

PropDescriptionTypeOptionsDefault
heightScrollbar heightstringpx/em/rem/dynamic—
maxHeightMaximum scrollbar heightstringpx/em/rem/dynamic—
ScrollWidthScrollbar widthstringpx/em/rem/dynamic—
widthXEnable horizontal scrollbarboolean—false
thumbColorThumb colorstringHex or named color—
thumbHoverColorThumb hover colorstringHex or named color—
trackColorTrack colorstringHex or named color—
disabledHeightDisable vertical scrollbarboolean—false
disabledWidthDisable horizontal scrollbarboolean—false
disabledScrollDisable scrolling functionalityboolean—false
cornerConnect corner when both scrollbars are enabledboolean—false
tagContainer tagstringAny HTML tagdiv

Type Definitions ​

typescript
interface ScrollbarProps {
  height?: string;
  maxHeight?: string;
  ScrollWidth?: string;
  widthX?: boolean;
  thumbColor?: string;
  thumbHoverColor?: string;
  trackColor?: string;
  disabledHeight?: boolean;
  disabledWidth?: boolean;
  disabledScroll?: boolean;
  corner?: boolean;
  tag?: string;
}

Released under the MIT License.