@digital-ai/dot-components

中文文档
8.3.0发布于 2026/11/03SEE LICENSE IN <LICENSE.md>TypeScriptES Module近 30 天下载 5078

A component library the follows the Dot Design System

原始使用文档
文档目录12 节
  1. Welcome! 👋
  2. Installation
  3. Theme Provider
  4. Configuring Jest
  5. Targeting CSS ClassNames
  6. Resolving Style Conflicts
  7. Updating
  8. Font Icons
  9. Contributing
  10. Code Style Guide
  11. Change Log
  12. Security Policy

@digital-ai/dot-components

npm version npm (prod) dependency version

Welcome! 👋

So you've decided to use dot-components in your application, that's fantastic. Be sure to come say "hi" in the #dot-components channel in Slack and let us know how you're using our library.

Installation

# with npm
npm install @digital-ai/dot-components

# with yarn
yarn add @digital-ai/dot-components

Theme Provider

The DotThemeProvider provides the theme for the components in this library. When using this library you will need to wrap your application with it like this:

<DotThemeProvider>
  <App />
</DotThemeProvider>

Once your application is wrapped with DotThemeProvider, your styled components can use colors and spacings from the theme:

import styled, { css } from 'styled-components';

const StyledWidget = styled.div`
  ${({ theme }) => css`
    background-color: ${theme.palette.secondary[300]};
    border: 1px solid ${theme.palette.primary.main};
    .my-widget-text {
      margin-left: ${theme.spacing(2)};
    }
  `}
`;

export interface MyWidgetProps {
  text: string;
}

export const MyWidget = ({ text }: MyWidgetProps) => {
  return (
    <StyledWidget>
      <div className="my-widget-text">{text}</div>
    </StyledWidget>
  );
};

Note: If you would like to create a custom theme, you can do so by following these directions.

Configuring Jest

We are utilizing @digital-ai/dot-icons which uses @font-face. If you are using Jest then you'll need to update the following files. The location of the files may be different based on the structure of your application

jest.config.js

moduleNameMapper: {
  '@digital-ai/dot-icons': '<rootDir>/testing-utils/style-mock.ts',
  '@digital-ai/dot-illustrations': '<rootDir>/testing-utils/style-mock.ts',
}

style-mock.ts

module.exports = {};

Targeting CSS ClassNames

There are three different types of CSS class names that are used: dot- classes, Mui classes, and styled-components classes. You are encouraged to use the dot- classes in your application styles, but you can also use the Mui classes if you prefer. It is important to note that the Mui classes are subject to change and are not guaranteed to be stable across releases.

Note: The styled-components classes are generated by the library and should NOT be used, they will look like random letters, ex: kMprfx

Resolving Style Conflicts

It is possible that existing application styles might target native elements in ways that will conflict with styles from dot-components.

Because dot- classes are applied to native elements that are part of dot-components, such conflicts can be resolved by making minor changes to the application styles.

For example, suppose the application includes global styling like this:

input {
  background-color: red;
}

To override this styling for dot-components, this could be changed to:

input:not(.dot-input) {
  background-color: red;
}

Updating

When you're ready to pull in the latest version of the dot-components package run the following command.

# with npm
npm update @digital-ai/dot-components@latest

# with yarn
yarn upgrade @digital-ai/dot-components@latest

Font Icons

Find which icon you would like to use by going to .dot design system

Follow the code example shown here

Note: You can use search in the upper right corner to search for an icon if you know its name.

If you're using the DotIcon component then you do not need to pass in the icon- prefix of the icon name.

Contributing

Learn about how to contribute

Code Style Guide

Learn about our code style guide

Change Log

Learn about the latest improvements.

Security Policy

Learn about our security policy

版本与发布记录

@digital-ai/dot-components 共发布 329 个版本,首次发布于 2021/01/11;过去 12 个月发布了 30 个版本。

版本发布日期距今
8.3.0latest2026/11/038 天前
8.0.0-snapshot.20261030123233snapshot2026/10/3012 天前
8.0.0-snapshot.202610291219242026/10/2913 天前
8.2.02026/10/1626 天前
8.1.02026/10/011 个月前
8.0.0-snapshot.202609291221592026/09/291 个月前

其他发布通道:next → 2.0.0-rc.3,previous → 1.21.12,snapshot → 8.0.0-snapshot.20261030123233。

关于 @digital-ai/dot-components 的常见问题

@digital-ai/dot-components 是什么?

A component library the follows the Dot Design System

如何安装 @digital-ai/dot-components?

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

@digital-ai/dot-components 支持 TypeScript 吗?

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

@digital-ai/dot-components 支持 ESM 还是 CommonJS?

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

@digital-ai/dot-components 可以商用吗?

@digital-ai/dot-components 使用 SEE LICENSE IN <LICENSE.md> 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@digital-ai/dot-components 的下载量有多少?

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

@digital-ai/dot-components 还在维护吗?

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