0.13.5 • Published 6 months ago

mac-scrollbar v0.13.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

mac-scrollbar

English | 中文

npm mac-scrollbar mac-scrollbar

Scrollbar React component with macOS style.

Why mac-scrollbar

The scroll bar of each browser has a unique style and the width is also inconsistent, thus compressing the display of the content area. Now, we need a beautiful and simple scroll bar from macOS style.

  • Use native browser to scroll
  • Does not affect the design layout
  • No additional DOM hierarchy
  • Automatically adapt to change in width and height
  • 2KB compressed size
  • Support Chrome, Firefox >= 64, Microsoft Edge >= 79

Note This component is not compatible with IE11, it needs to be compatible with lower version browsers.

Usage

yarn add mac-scrollbar

Import style

import 'mac-scrollbar/dist/mac-scrollbar.css';

Basic

import { MacScrollbar } from 'mac-scrollbar';

function Foo() {
  return (
    <MacScrollbar>
      <div>Content</div>
    </MacScrollbar>
  );
}

Global window scrollbar

import { GlobalScrollbar } from 'mac-scrollbar';

function App() {
  return <GlobalScrollbar />;
}

API

Common

NameTypeDescription
skin'light' | 'dark'Adapt to the background color of the container. Default 'light'
trackGapnumber | TrackGap | ((showBarX: boolean, showBarY: boolean) => TrackGap)Gap at the cross end of the scroll bar. Default 16
trackStyle(horizontal?: boolean) => CSSProperties
thumbStyle(horizontal?: boolean) => CSSProperties
minThumbSizenumberMinimum thumb bar size. Default 20
suppressAutoHidebooleanWhen set to true, the scrollbar will not be automatically hidden.

MacScrollbar

NameTypeDescription
suppressScrollXnumberWhen set to true, the scrollbar in X-axis will not be available, regardless of the content width.
suppressScrollYnumberWhen set to true, the scroll bar in Y-axis will not be available, regardless of the content height.
asstringCustom element type. Default 'div'
0.13.0

6 months ago

0.13.1

6 months ago

0.13.2

6 months ago

0.13.3

6 months ago

0.13.4

6 months ago

0.12.5

6 months ago

0.13.5

6 months ago

0.11.0

6 months ago

0.12.0

6 months ago

0.12.1

6 months ago

0.12.2

6 months ago

0.12.3

6 months ago

0.10.7

1 year ago

0.10.5

1 year ago

0.10.6

1 year ago

0.10.4

1 year ago

0.10.2

2 years ago

0.10.3

2 years ago

0.10.1

2 years ago

0.9.7

2 years ago

0.10.0

2 years ago

0.9.4

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.9.3

2 years ago

0.9.0

2 years ago

0.8.0

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.7.3

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.1

3 years ago

0.5.2

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.1

3 years ago

0.4.3

3 years ago

0.5.1

3 years ago

0.4.2

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.2.0

3 years ago