@dscout/particle

中文文档
1.0.0-alpha.59发布于 2026/09/29MITTypeScriptESM + CJS近 30 天下载 7393

A pattern library for building dscout user interfaces

原始使用文档
文档目录11 节
  1. Usage
  2. React Version Support
  3. Peer dependencies
  4. Importing
  5. Stylesheets
  6. Developing with Storybook
  7. Install dependencies
  8. Start Storybook
  9. Scripts
  10. Contributing
  11. Releasing a new version

Particle

A CSS framework and React component library for building dscout user interfaces. Visit the documentation site to learn more.

Usage

Install particle using yarn or npm:

$ yarn add @dscout/particle
$ npm install --save @dscout/particle

React Version Support

Particle supports both React 18.x and React 19.x applications. No code changes are required when upgrading between React versions. Note that Particle is built using React 18.x, so usage with React 19.x should be done with this in mind and developers should validate components behave as expected.

# React 18 applications
yarn add @dscout/particle react@^18.0.0 react-dom@^18.0.0

# React 19 applications
yarn add @dscout/particle react@^19.0.0 react-dom@^19.0.0

Peer dependencies

Particle requires the implementing application install React (react, react-dom) and React Router (react-router-dom). @floating-ui/dom — which powers the tooltip and dropdown components — is a regular dependency of Particle and installs automatically; the implementing application does not need to add it.

Importing

Everything is a named export on the namespace "@dscout/particle," for example:

import React from 'react';
import { Container, Heading } from '@dscout/particle';

export default function Announcement() {
  return (
    <Container>
      <Heading level="2">Important!</Heading>
      <p>Make sure to eat your vegetables.</p>
    </Container>
  );
}

Stylesheets

Stylesheets are included in two formats: css and scss.

Pre-compiled stylesheets are located in the lib directory of the build output. To import into a plain CSS file:

@import 'node_modules/@dscout/particle/lib/stylesheets/particle.css';
@import 'node_modules/@dscout/particle/lib/stylesheets/particle.min.css';

The source scss file is located in the styles directory. You can import it into your own scss file like so:

@import '@dscout/particle/styles/particle.scss';

Developing with Storybook

Storybook provides an isolated development environment for Particle components as well as a published static site that serves as a playground and documentation.

Install dependencies

Particle uses asdf to manage the node dependencies. To develop locally first install asdf with:

brew install asdf

Then install nodejs. If you don't already have nodejs set up on your machine you may first need install its dependencies and OpenPGP keys:

brew install coreutils
brew install gpg
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring

Install asdf dependencies

asdf install

Install NPM dependencies with yarn:

yarn install

Start Storybook

Run Storybook locally:

yarn start

Scripts

A variety of scripts are provided for running common tasks.

Lint with ESLint and run typechecker:

yarn lint

Start the Vitest test runner in watch mode:

Note: Before testing, you will need to run yarn playwright install to ensure the local test runner can properly spin up the necessary browser environment.

yarn test

Contributing

See the wiki for details on how to contribute to Particle.

Releasing a new version

Instructions for preparing a new release and submitting it to npm can be found here.

版本与发布记录

@dscout/particle 共发布 145 个版本,首次发布于 2017/01/27;过去 12 个月发布了 14 个版本。

版本发布日期距今
1.0.0-alpha.59latest2026/09/291 个月前
1.0.0-alpha.582026/08/262 个月前
1.0.0-alpha.572026/08/192 个月前
1.0.0-alpha.562026/07/213 个月前
1.0.0-alpha.552026/06/224 个月前
1.0.0-alpha.542026/05/275 个月前

其他发布通道:next → 1.0.0-alpha.4。

关于 @dscout/particle 的常见问题

@dscout/particle 是什么?

A pattern library for building dscout user interfaces

如何安装 @dscout/particle?

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

@dscout/particle 支持 TypeScript 吗?

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

@dscout/particle 支持 ESM 还是 CommonJS?

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

@dscout/particle 可以商用吗?

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

@dscout/particle 的下载量有多少?

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

@dscout/particle 还在维护吗?

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