@carbon/ibm-products

中文文档
2.102.0发布于 2026/10/28Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 13.7万

Carbon for IBM Products

原始使用文档
文档目录15 节
  1. 🚀 Getting started
  2. 📦 Installing Carbon for IBM Products
  3. Webpack 4
  4. Peer dependencies
  5. Examples
  6. Online examples
  7. Packages
  8. Usage
  9. Package prefix
  10. Enabling Canary components and flagged features
  11. Building and running locally
  12. Browser support
  13. 🙌 Contributing
  14. IBM Telemetry
  15. 📝 License

@carbon/ibm-products

Carbon for IBM Products is an open source implementation of the closed source pattern asset library (PAL). These PAL designs build on the foundation of IBM’s open source Carbon Design System and React implementation to offer components and patterns beyond the typical component library. Carbon for IBM Products was previously known as Carbon for IBM Cloud and Cognitive (@carbon/ibm-cloud-cognitive), and this name can still be encountered in various places and historical logs.

All Contributors Licensed under the Apache License, Version 2.0 Build status Netlify status GitHub Lerna version PRs welcome

Carbon for IBM Products common UI components

🚀 Getting started

If you’re just getting started and looking to browse our React components, take a look at our Storybook.

📦 Installing Carbon for IBM Products

To use Carbon for IBM Products components, all you need to do is install the @carbon/ibm-products package.

$ yarn add @carbon/ibm-products

# or

$ npm install @carbon/ibm-products

Then you can import the component styles in your index.js.

import '@carbon/ibm-products/css/index.min.css';

Webpack 4

Our package requires support for ES modules (see #2378). In Webpack 5, these are supported by default. In Webpack 4, you will need to add the following rule to your config.

rules: [
  {
    test: /\.mjs$/,
    include: /node_modules/,
    type: 'javascript/auto',
  },
],

Peer dependencies

@carbon/ibm-products is built on top of Carbon components and has a number of dependencies which need to be installed.

Note: @carbon/elements rolls up a number of Carbon packages that could be installed independently. As this list of dependencies could change, we leave you to view package.json in ibm-products if you wish to install individual packages.

Examples

Online examples

Examples for each released component, and some that are still not quite ready, can be found here on

CodeSandbox Stackblitz

Packages

You can find example projects using the components in the examples folder.

Usage

To start using the components

import { AboutModal } from '@carbon/ibm-products';

const App = () => {
  return <AboutModal />;
};

Package prefix

The @carbon/ibm-products package uses a default prefix of c4p for CSS selectors and some IDs.

Changing the prefix

Before any @carbon/ibm-products components are loaded in script or styling ensure you have done the following.

import { pkg } from '@carbon/ibm-products/es/settings';

pkg.prefix = 'tst';

When using multiple components from the library:

@use '@carbon/ibm-products/scss' with (
  $pkg-prefix: 'tst'
);

When using individual components e.g. AboutModal:

@use '@carbon/ibm-products/scss/config' with (
  $pkg-prefix: 'tst'
);

@use '@carbon/ibm-products/scss/components/AboutModal';

See the example gallery for the most up-to-date prefix examples.

Enabling Canary components and flagged features

Components that have not yet completed the release review process are considered to be canary and require the consumer to enable via a feature flag in a config.js file.

For example, create a config.js in your src directory:

import { pkg } from '@carbon/ibm-products';

// Enable 'canary' (not yet reviewed/released) components
// that we want to make use of
pkg.component.AboutModal = true;
pkg.component.SidePanel = true;

// Live dangerously: enable all components!
pkg.setAllComponents(true);

// Enable a feature flagged examples
pkg.feature.nameOfFeature = true;
pkg.feature['Component.feature'] = true;

// Live dangerously: enable all pre-release features!
pkg.setAllFeatures(true);

The default values for component and feature flag settings can be found by running the following command.

node node_modules/@carbon/ibm-products/flags.js

Note: The above settings must happen before a component first renders or a feature is first used.

Note: 2 In the case of features implemented via hooks the feature may function without enabling. In all cases features that disabled by default will log in the console a warning if enabled via a feature flag or an error if not.

Building and running locally

To get started, run the following commands and Storybook will be built and then served on port 3000 on your local machine.

yarn
yarn storybook

To build all the packages, run the following command.

yarn build

Browser support

This library supports the latest versions of:

  • Apple Safari
  • Google Chrome
  • Microsoft Edge
  • Mozilla Firefox

🙌 Contributing

This project is made possible by several community members who have invested their precious time to give back to the Carbon community. It will continue to be possible by having those that benefit from the package contribute back to it.

So, do not be shy. We both depend on and appreciate contributors, new and old, who help us fix bugs, build new features, improve our documentation, etc.

If you’re interested, definitely check out our Contributing Guide and Carbon’s Developer Handbook! 👀


Lee Chase

💻

David Menendez

💻

Matthew Gallo

💻

Simon Finney

💻

Polina Olemskaia

💻

IBM Telemetry IBM Telemetry

This package uses IBM Telemetry to collect de-identified and anonymized metrics data. By installing this package as a dependency you are agreeing to telemetry collection. To opt out, see Opting out of IBM Telemetry data collection. For more information on the data being collected, please see the IBM Telemetry documentation.

📝 License

Licensed under the Apache-2.0 License.

This site is powered by Netlify

版本与发布记录

@carbon/ibm-products 共发布 680 个版本,首次发布于 2021/11/17;过去 12 个月发布了 56 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.102.0latest2026/10/2812 天前
2.102.0-rc.0next2026/10/2712 天前
2.101.02026/10/1426 天前
2.101.0-rc.02026/10/1227 天前
2.100.02026/09/301 个月前
2.100.0-rc.02026/09/281 个月前

其他发布通道:latest-v1 → 1.53.1,v1-latest → 1.73.6,canary → 2.54.0-canary.81,next → 2.102.0-rc.0。

关于 @carbon/ibm-products 的常见问题

@carbon/ibm-products 是什么?

Carbon for IBM Products

如何安装 @carbon/ibm-products?

在项目目录运行 npm install @carbon/ibm-products,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.8.6 || ^17.0.1 || ^18.2.0 || ^19.0.0)、react-is(^16.13.1 || ^17.0.2 || ^18.3.1 || ^19.0.0)、react-dom(^16.8.6 || ^17.0.1 || ^18.2.0 || ^19.0.0)、@carbon/grid(^11.64.0)、@carbon/type(^11.69.0)、@carbon/react(^1.118.0)、@carbon/layout(^11.61.0)、@carbon/motion(^11.54.0)、@carbon/themes(^11.83.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@carbon/ibm-products 支持 TypeScript 吗?

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

@carbon/ibm-products 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@carbon/ibm-products 可以商用吗?

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

@carbon/ibm-products 的下载量有多少?

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

@carbon/ibm-products 还在维护吗?

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