@atlaskit/css-reset

中文文档
8.4.10发布于 2026/11/05Apache-2.0TypeScriptES Module近 30 天下载 15.5万

A base stylesheet for the Atlassian Design System.

原始使用文档
文档目录4 节
  1. Installation
  2. Usage
  3. Standalone scrollbar appearance
  4. Avoiding a flash of un-harmonized scrollbars on SSR pages

CSS reset

A base stylesheet for ADG.

Installation

yarn add @atlaskit/css-reset

Usage

View documentation.

Standalone scrollbar appearance

Products that do not consume the full CSS reset can import only the harmonized scrollbar styles:

import '@atlaskit/css-reset/scrollbars.css';

The stylesheet remains inactive until the product adds data-scrollbar-harmonisation to the document root. Products own feature-gate evaluation and attribute cleanup. Tracks are always transparent; no separate transparency attribute is needed.

Only colors change: the thumb uses color.background.accent.gray.subtle and the track is transparent, set once with scrollbar-color on the root and inherited. Scrollbar size, visibility and overlay behavior stay native, so operating system preferences such as macOS "When scrolling" are honored and apply live when changed. Custom WebKit scrollbar sizing is not used because browsers never draw it as an overlay. Browsers without scrollbar-color support keep native colors. Forced colors use browser colors.

In Chromium, a non-auto scrollbar-color disables ::-webkit-scrollbar styles on the same element. Components that own a custom WebKit scrollbar should set their own scrollbar-color, or scrollbar-color: auto, on their scroll container.

The subtle token has approximately 3.24:1 contrast against the white page surface in light mode and 2.85:1 against the #1F1F21 page surface in dark mode; contrast is lower on raised and overlay surfaces. This contrast is accepted for the harmonized treatment, which is not a claim of accessibility conformance. Painted width and allocated width are not a target-size conformance assessment.

Avoiding a flash of un-harmonized scrollbars on SSR pages

The attributes above are normally installed on document.documentElement at runtime by useScrollbarHarmonisation (@atlaskit/app-provider/use-scrollbar-harmonisation). On a server-rendered page that hook only runs client-side, so scrollbars briefly render un-harmonized until the effect fires. Products that render <html> from a server-side template can instead call getScrollbarHarmonisationHtmlAttrs (@atlaskit/app-provider/get-scrollbar-harmonisation-html-attrs) and spread its result onto the server-rendered <html> element, so the attributes — and therefore these CSS rules — are present from the very first paint.

版本与发布记录

@atlaskit/css-reset 共发布 161 个版本,首次发布于 2017/01/30;过去 12 个月发布了 32 个版本。

版本发布日期距今
8.4.10latest2026/11/052 天前
8.4.92026/11/043 天前
8.4.82026/10/308 天前
8.4.72026/10/299 天前
8.4.62026/09/241 个月前
8.4.52026/09/231 个月前

其他发布通道:next → 6.5.2。

关于 @atlaskit/css-reset 的常见问题

@atlaskit/css-reset 是什么?

A base stylesheet for the Atlassian Design System.

如何安装 @atlaskit/css-reset?

在项目目录运行 npm install @atlaskit/css-reset,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^18.2.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@atlaskit/css-reset 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@atlaskit/css-reset 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@atlaskit/css-reset 可以商用吗?

@atlaskit/css-reset 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@atlaskit/css-reset 的下载量有多少?

根据 npm 官方下载统计,@atlaskit/css-reset 在 2026/10/07 – 2026/11/05 这 30 天内被下载 155,003 次,日均约 5,167 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@atlaskit/css-reset 还在维护吗?

最新版本 8.4.10 发布于 2026/11/05(2 天前);至今共发布 161 个版本,其中过去 12 个月发布了 32 个;首次发布于 2017/01/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。