@db-ux/core-components

中文文档
6.3.2发布于 2026/11/11Apache-2.0ES Module构建来源已验证近 30 天下载 8808

General technical components (styling, fonts and icons) out of DB UX Design System – Generation 3

原始使用文档
文档目录10 节
  1. Package Relationship
  2. Install
  3. Styling Dependencies
  4. Import
  5. DB Theme
  6. Optimize dependencies
  7. Deutsche Bahn brand
  8. Contributions
  9. Code of conduct
  10. License

@db-ux/core-components

Apache 2.0 license badge code style: prettier Conventional Commits PRs Welcome

A library containing all styles for components of DB UX Design System – Generation 3.

Note Furthermore we currently support these additional JavaScript frameworks, with more coming soon:

Please take a look at your desired framework to retrieve more information.

For additional information besides the frameworks see our Getting started.


If you just need the styling follow this:

Package Relationship

✅ Do I need foundations if I install components?

No! The @db-ux/core-components package automatically includes all the foundations (@db-ux/core-foundations) you need. You only need to include one package:

  • Use @db-ux/core-components - If you want to use UI components (buttons, inputs, etc.)
  • Use @db-ux/core-foundations - If you only need design tokens, colors, spacing, fonts, and assets without any component styles

Install

npm i @db-ux/core-components

Note: This automatically includes @db-ux/core-foundations as a dependency, if you use npm. If you use pnpm you need to install @db-ux/core-foundations as well.

Styling Dependencies

Import the styles in css. Based on your technology the file names could be different.

  • relative: asset path point to ../assets
  • webpack: asset path point to ~@db-ux/core-foundations/assets
  • rollup: asset path point to @db-ux/core-foundations/assets

Important: These bundled files automatically include all dependencies from foundations (design tokens, colors, fonts, etc.) and all components - everything you need in one import!

Import

Import the styles in your main .css file.

/* index.css */
@layer whitelabel-theme, db-ux;
/* You may want to include another theme here, this is a whitelabel theme! So instead of including the following line of code, please have a look at the DB Theme section */
@import "@db-ux/core-foundations/build/styles/theme/rollup.css"
    layer(whitelabel-theme);

@import "@db-ux/core-components/build/styles/bundle.css" layer(db-ux);

Vite 8 Note: Starting with Vite 8, the default CSS minifier was changed to LightningCSS, which provides buggy transformations for modern CSS features used by the DB UX Design System (e.g. light-dark() CSS function). We might provide a specific configuration necessary to mitigate those problems in the near future. To keep CSS output stable in the meantime, configure vite.config.ts like this:

// vite.config.ts
export default defineConfig({
    build: {
        cssMinify: "esbuild"
    }
});

Alternatively, you could define a browserslist based on your individual browser support strategy — which might be totally different from the list Vite 8 defines by default (targeting browsers from the early 2020s):

// Note: You need to install the required packages first:
// npm install -D lightningcss browserslist

// vite.config.ts
import { browserslistToTargets } from "lightningcss";
import browserslist from "browserslist";

export default defineConfig({
    css: {
        lightningcss: {
            targets: browserslistToTargets(
                browserslist(
                    ">= 0.5%, last 2 major versions, Firefox ESR, not dead"
                )
            )
        }
    }
});

DB Theme

In case that you're building a website or application for Deutsche Bahn, you'll additionally have to install the DB Theme via the @db-ux/db-theme node package (even also available as an inner source node package, as described within that packages README).

Optimize dependencies

If you only need some of the components or some features from @db-ux/core-foundations, you shouldn't include the bundled file. In the case you want to include only some components, and you could do it like this:

/* The theme contains all props required for components like spacings, colors, ... */
@import "@db-ux/core-foundations/build/styles/bundle.css";
/* The font include uses default font families based on your bundling paths (relative, absolute, webpack, rollup) */
@import "@db-ux/core-foundations/build/styles/fonts/rollup.css";
/* The required styles will normalize css and add focus and default font to body */
@import "@db-ux/core-foundations/build/styles/defaults/default-required.css";
/* The default setting for :root, adds a color space (neutral-bg-basic-level-1) and a density (regular). */
@import "@db-ux/core-foundations/build/styles/defaults/default-root.css";

/* Optional: Add animations / transitions for components */
@import "@db-ux/core-components/build/styles/component-animations.css";

/* Optional: Add data-icon/data-icon-trailing to global attributes to enable icons for components */
@import "@db-ux/core-foundations/build/styles/icons/rollup.css";

/* Optional: Add components */
@import "@db-ux/core-components/build/components/button/button.css";
@import "@db-ux/core-components/build/components/input/input.css";

Deutsche Bahn brand

As we'd like to perfectly support our users and customers on their digital journey, the usage of Deutsche Bahn brand and trademarks are bound of clear guidelines and restrictions even if being used with the code that we're providing with this product; Deutsche Bahn fully reserves all rights regarding the Deutsche Bahn brand, even though that we're providing the code of DB UX Design System products free to use and release it under the Apache 2.0 license. Please have a look at our brand portal at https://marketingportal.extranet.deutschebahn.com/ for any further questions and whom to contact on any brand issues.

For any usage outside of Deutsche Bahn websites and applications you aren't allowed to use any Deutsche Bahn brand and design assets as well as protected characteristics and trademarks, that for not including the DB Theme.

Contributions

Contributions are very welcome, please refer to the contribution guide.

Code of conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone – have a look at our Contributor Covenant Code of Conduct.

License

This project is licensed under Apache-2.0.

版本与发布记录

@db-ux/core-components 共发布 200 个版本,首次发布于 2025/02/13;过去 12 个月发布了 119 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.3.2latest2026/11/11今天
6.3.12026/11/101 天前
6.3.02026/11/056 天前
6.2.12026/11/047 天前
6.2.1-optimized-icon-fonts-amount2-b78987enext2026/11/047 天前
6.2.02026/10/2913 天前

关于 @db-ux/core-components 的常见问题

@db-ux/core-components 是什么?

General technical components (styling, fonts and icons) out of DB UX Design System – Generation 3

如何安装 @db-ux/core-components?

在项目目录运行 npm install @db-ux/core-components,或使用 pnpm add / yarn add / bun add。

@db-ux/core-components 支持 TypeScript 吗?

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

@db-ux/core-components 支持 ESM 还是 CommonJS?

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

@db-ux/core-components 可以商用吗?

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

@db-ux/core-components 的下载量有多少?

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

@db-ux/core-components 还在维护吗?

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