@dnanpm/styleguide

中文文档
4.0.14发布于 2026/09/28ISCTypeScriptESM + CJS近 30 天下载 3170

DNA Styleguide repository provides the set of components and theme object used in various DNA projects.

原始使用文档
文档目录9 节
  1. Installation
  2. Documentation
  3. Interactive documentation and API
  4. Changelog
  5. Migration guide
  6. Contribution guide
  7. Usage example
  8. Theme
  9. Component

DNA Styleguide repository provides the set of components and theme object used in various DNA projects.

Installation

Run install command in repository where DNA Styleguide should be added

npm install @dnanpm/styleguide

Documentation

[!NOTE] Requires access to DNA Cloud URL!

Interactive documentation and API

See latest version of DNA Styleguide for theme documentation, API and interactive documentation of components.

Changelog

See Changelog for current major version changes, or Changelog Archive for old major versions' changes.

Migration guide

See Migration guide for more information about how to migrate between major versions of DNA Styleguide.

Contribution guide

See Contribution guide for more information about how to contribute to DNA Styleguide.

Usage example

Theme

import { theme as defaultTheme } from '@dnanpm/styleguide';

const color = {
    ...defaultTheme.color,
    background: '#000000',
};

const iconSize = {
    default: '0.75em',
    defaultMobile: '2em',
};

const theme = {
    ...defaultTheme,
    colors,
    iconSize,
};

export type ThemeInterface = typeof theme;
export default theme;
import theme from './theme';

class MyApp {
    public render() {
        const { Component, pageProps } = this.props;

        return (
            <ThemeProvider theme={theme}>
                <Component {...pageProps} />
            </ThemeProvider>
        );
    }
}

Component

import { ButtonPrimary } from '@dnanpm/styleguide';

interface Props {
    myProp?: string;
}

const MyComponent = ({
    myProp,
}: Props) => {
    return (
        <ButtonPrimary>{myProp || 'Lorem Ipsum'}</ButtonPrimary>
    );
};

export default MyComponent;

版本与发布记录

@dnanpm/styleguide 共发布 88 个版本,首次发布于 2019/09/20;过去 12 个月发布了 15 个版本。

版本发布日期距今
4.0.14latest2026/09/281 个月前
4.0.132026/09/072 个月前
4.0.122026/08/312 个月前
4.0.112026/07/144 个月前
4.0.102026/05/295 个月前
4.0.92026/05/046 个月前

关于 @dnanpm/styleguide 的常见问题

@dnanpm/styleguide 是什么?

DNA Styleguide repository provides the set of components and theme object used in various DNA projects.

如何安装 @dnanpm/styleguide?

在项目目录运行 npm install @dnanpm/styleguide,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=17.x <=19.x)、react-dom(>=17.x <=19.x)、@dnanpm/icons(^2.x)、styled-components(6.x)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dnanpm/styleguide 支持 TypeScript 吗?

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

@dnanpm/styleguide 支持 ESM 还是 CommonJS?

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

@dnanpm/styleguide 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dnanpm/styleguide 可以商用吗?

@dnanpm/styleguide 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@dnanpm/styleguide 的下载量有多少?

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

@dnanpm/styleguide 还在维护吗?

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