Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mac-scrollbar

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mac-scrollbar

A macos style react scroll bar component

  • 0.13.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
increased by19.79%
Maintainers
1
Weekly downloads
 
Created
Source

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'

FAQs

Package last updated on 26 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc