npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mac-scrollbar-better

v0.13.8

Published

A macos style react scroll bar component

Downloads

6

Readme

mac-scrollbar

中文 | English

npm mac-scrollbar mac-scrollbar

macOS 样式的 React 滚动条组件

为什么使用 mac-scrollbar

每个浏览器的滚动条都带有独特的样式,并且宽度也不一致,从而压缩内容区域的展示。现在,我们需要一个漂亮而又简约来自 macOS 样式的滚动条。

  • 使用原生浏览器滚动
  • 不影响设计布局
  • 不占用额外的 DOM 层级
  • 自动适应宽高的变化
  • 2KB 压缩尺寸
  • 支持 Chrome、Firefox >= 64、Microsoft Edge >= 79

注意 此组件不兼容 IE11,需要兼容低版本浏览器勿用。

安装

yarn add mac-scrollbar

引入样式

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

基本使用

import { MacScrollbar } from 'mac-scrollbar';

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

全局滚动条

import { GlobalScrollbar } from 'mac-scrollbar';

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

API

公共

| Name | Type | Description | | :--------------- | :------------------------------------------------------------------------- | :----------------------------------- | | skin | 'light' | 'dark' | 适应容器的滚动条主题,默认 'light' | | trackGap | number | TrackGap | ((showBarX: boolean, showBarY: boolean) => TrackGap) | 滚动条交叉末端的间隙,默认 16 | | trackStyle | (horizontal?: boolean) => CSSProperties | | | thumbStyle | (horizontal?: boolean) => CSSProperties | | | minThumbSize | number | 最小的拇指条尺寸,默认 20 | | suppressAutoHide | boolean | 设置为 true 时,滚动条都不会自动隐藏 |

MacScrollbar

| Name | Type | Description | | :-------------- | :----- | :--------------------------------------------------------- | | suppressScrollX | number | 设置为 true 时,无论内容宽度如何,X 轴上的滚动条都将不可用 | | suppressScrollY | number | 设置为 true 时,无论内容高度如何,Y 轴的滚动条都将不可用 | | as | string | 自定义元素类型。默认 'div' |