@amsterdam/design-system-css

中文文档
4.5.0发布于 2026/10/22EUPL-1.2零依赖构建来源已验证近 30 天下载 1.5万

Stylesheets for all components from the Amsterdam Design System and some general utilities. Use it to apply the visual design of the City of Amsterdam to your HTML elements or non-React components.

原始使用文档
文档目录10 节
  1. Introduction
  2. Installation
  3. Usage
  4. In JSX
  5. In HTML
  6. Compact Mode
  7. Lo-fi Mode
  8. Global styles
  9. Updating
  10. Support

Amsterdam Design System: CSS components

This package provides stylesheets for all components in the Amsterdam Design System and some general utilities. Use it to apply the visual design of the City of Amsterdam to your HTML elements or non-React components.

Introduction

We publish our components’ stylesheets as a separate package to help replicating them in other libraries, platforms, or SaaS applications. The classes are a contract between the component’s definition and its implementations and they facilitate ongoing upgrades.

Our React components use these classes in the HTML they render. You should use that package if your application uses React.

A couple of utility classes are included for general use: aspect ratio, bottom margin, gap, and visually hidden.

Installation

The stylesheets reference our design tokens. Both packages need to be installed.

npm install @amsterdam/design-system-css @amsterdam/design-system-tokens

Usage

The set of classes for a component can be seen as a blueprint for its markup and features. An .ams-component root selector applies the essential styles of the component to its element, and additional classes like .ams-component--variant modify its appearance or behaviour.

The classes employ the naming convention of NL Design System. Other communities only need to overwrite design tokens to use our components with their branding.

In JSX

Import the main stylesheet and use the class names in your markup.

import "@amsterdam/design-system-assets/font/index.css"
import "@amsterdam/design-system-css/dist/index.css"
import "@amsterdam/design-system-tokens/dist/index.css"

export const App = () => (
  <p className="ams-paragraph">Hello, world!</p>
)

In HTML

Although it is not a typical use case, the stylesheet can be included in an HTML page directly.

<!doctype html>
<html lang="en">
  <head>
    <link rel="stylesheet" href="node_modules/@amsterdam/design-system-assets/font/index.css" />
    <link rel="stylesheet" href="node_modules/@amsterdam/design-system-css/dist/index.css" />
    <link rel="stylesheet" href="node_modules/@amsterdam/design-system-tokens/dist/index.css" />
  </head>
  <body class="ams-body">
    <p class="ams-paragraph">Hello, world!</p>
  </body>
</html>

Compact Mode

Load the compact tokens to use the compact appearance of the design system, e.g. for internal websites with a high information density. They override the spacious ones; the stylesheets can remain unchanged.

Lo-fi Mode

Load the Lo-fi tokens to present pages as a sketch, e.g. to keep a design review focused on structure and content. They override the default appearance; the stylesheets can remain unchanged here as well.

Global styles

Some elements of your document are out of reach for the Design System components. However, their styles can influence the appearance of the components.

Set a class on the body

Add the ams-body class to your document’s <body> tag. This removes white space that the browser might add. In Compact Mode, it also sets the background color to match the Page component seamlessly.

We don’t have a separate, global reset stylesheet. This follows from our component-based architecture: every component overwrites user agent styles on the elements they render. You shouldn’t need a reset stylesheet.

Keep the base font size

Do not change the base font-size – e.g. through html { font-size: 62.5% }. Our typography system expects 1rem to be the browser default of 16 pixels.

Updating

We follow semantic versioning and publish a change log to guide you through updates. The classes are a public API of the design system. Note that detecting changed or deleted classes is still a manual process.

Support

Contact us if you have a question, find an issue, or want to contribute. Find ways to reach us on designsystem.amsterdam.

版本与发布记录

@amsterdam/design-system-css 共发布 47 个版本,首次发布于 2023/02/10;过去 12 个月发布了 12 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
4.5.0latest2026/10/2216 天前
4.4.02026/08/092 个月前
4.3.02026/07/133 个月前
4.2.02026/06/244 个月前
4.1.02026/04/256 个月前
4.0.02026/04/206 个月前

关于 @amsterdam/design-system-css 的常见问题

@amsterdam/design-system-css 是什么?

Stylesheets for all components from the Amsterdam Design System and some general utilities. Use it to apply the visual design of the City of Amsterdam to your HTML elements or non-React components.

如何安装 @amsterdam/design-system-css?

在项目目录运行 npm install @amsterdam/design-system-css,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@amsterdam/design-system-assets(2.7.0)、@amsterdam/design-system-tokens(4.4.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@amsterdam/design-system-css 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/amsterdam__design-system-css 是否存在。

@amsterdam/design-system-css 可以商用吗?

@amsterdam/design-system-css 使用 EUPL-1.2 许可。声明的许可为 EUPL-1.2,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@amsterdam/design-system-css 的下载量有多少?

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

@amsterdam/design-system-css 还在维护吗?

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