@doist/reactist

中文文档
37.4.0发布于 2026/09/08MITTypeScriptESM + CJS构建来源已验证近 30 天下载 3251

Open source React components by Doist

原始使用文档
文档目录10 节
  1. Theming
  2. Creating new components
  3. Storybook
  4. Inside your application
  5. Development tips and tricks
  6. Chromatic visual regression tests
  7. Enable tests
  8. Review tests
  9. How it works
  10. Thanks

Reactist

Open source React components made with ❤️ by Doist.

npm version MIT Licence code style: prettier PRs Welcome

Check out our live demo. It includes all currently implemented components plus a live playground to interact with them in different states.

How to use reactist

You can add Reactist to your project by installing it from npm:

npm install @doist/reactist

To import a component within your code:

import { Loading } from '@doist/reactist'
//OR
import Loading from '@doist/reactist/dist/Loading'

You also need to load the CSS file of reactist somewhere in your app. For instance:

<link rel="stylesheet" type="text/css" href="./node_modules/@doist/reactist/styles/Loading.css" />

If you prefer to include static files grab the minified build from the dist folder.

<script src="./node_modules/@doist/reactist/dist/reactist.cjs.production.min.js"></script>
<link rel="stylesheet" type="text/css" href="./node_modules/@doist/reactist/styles/reactist.css" />

Theming

Reactist bakes a light palette (@doist/product-libraries-tokens) into reactist.css. To use a dark or accent theme, load one of the theme files Reactist re-exports and toggle its class on the root element:

<link rel="stylesheet" href="./node_modules/@doist/reactist/styles/tokens/<theme_name>.css" />
import '@doist/reactist/styles/tokens/<theme_name>.css'

Then set the matching class on :root. Each theme file sets its own color-scheme, so you do not need to declare it yourself — the column below is what you get, not what you set.

Theme / file namecolor-schemeclass
td-lightlightnone
td-darkdarktheme_dark
td-blueberrylighttheme_blueberry
td-blueberry-darkdarktheme_blueberry_dark
td-goldlighttheme_gold
td-gold-darkdarktheme_gold_dark
td-kalelighttheme_kale
td-kale-darkdarktheme_kale_dark
td-lavenderlighttheme_lavender
td-lavender-darkdarktheme_lavender_dark
td-moonstonelighttheme_moonstone
td-moonstone-darkdarktheme_moonstone_dark
td-raspberrylighttheme_raspberry
td-raspberry-darkdarktheme_raspberry_dark
td-tangerinelighttheme_tangerine
td-tangerine-darkdarktheme_tangerine_dark

Changelog

You can find our changelog here.

Development

We leverage package.json's engines field to specify the node/npm versions to be used while in development. The easiest way to switch quickly is through fnm.

It's worth noting that fnm can automatically switch to a project's specified node version when it encounters a .nvmrc file. To do so, use the --use-on-cd flag when generating your shell's config script with fnm env.

Once fnm is installed, clone the repository. Then, switch to the required node version, and run its setup task:

git clone https://github.com/doist/reactist.git
cd reactist
fnm install
fnm use
npm run setup

The setup task will install dependencies and run various validations (linting, type checking, tests).

We identified two major modes of development for Reactist. First, running an interactive storybook and see the changes you make to a component in an isolated environment. This is especially helpful when developing new components. And second, improving existing components in real-life applications.

Creating new components

The development of new components is streamlined by the ability to generate new component templates using plop:

npm run plop component

This command will prompt you to provide all the information needed to create a new component template. The most important piece of information needed is the component name, which you can provide even as a phrase (e.g. "dropdown select" will generate a DropdownSelect component template).

The generated source files include the component implementation with sample props and styles, plus a small test file and storybook source files as well.

You also need to export your new component by adding a reference to it in the top-level index file.

Storybook

For the first development mode run:

npm run storybook

This boots up a development server with hot reloading on http://localhost:6006. You can iterate on the components in the existing stories or add a completely new one.

Inside your application

For the second development mode you can leverage npm start:yalc. First, make sure you have yalc installed globally:

npm install -g yalc

Then, in the reactist repository run:

npm run start:yalc

this will publish Reactist to yalc and watch for changes.

In your host application you can then link to your local Reactist version:

cd ~/your-app
yalc add @doist/reactist

To undo the changes and switch back to the reactist version from npm, do the following:

cd ~/your-app
# restore the original reactist version
yalc remove @doist/reactist
# re-install reactist from npm
npm install

For convenience, you can add a dev:reactist script in your host application to automate the process of adding and removing the local Reactist version:

{
    // ...
    scripts: {
        // ...
        'predev:reactist': 'yalc add @doist/reactist',
        'dev:reactist': 'npm run dev', // or whatever your development script is
        'postdev:reactist': 'yalc remove @doist/reactist && npm i',
    },
}

Then, to develop against Reactist, just run:

npm run dev:reactist

Development tips and tricks

Independent of the development you operate in to produce a new build (e.g. before submitting a PR) run:

npm run build

Note: This will not update the docs. In case you want to update the docs you need to run:

npm run build:storybook

Testing

Tests are executed by running:

npm run test

During development you may find it beneficial to continuously execute the tests. This works by running:

npm run test -- --watch

MacOS users might need to upgrade watchman with brew install watchman when experiencing troubles with the watch mode. See this issue for details: https://github.com/facebook/jest/issues/1767

Chromatic visual regression tests

Reactist relies on Chromatic to run visual regression tests on our component during the CI step in GitHub.

Enable tests

To enable such tests, just add chromatic: { disableSnapshot: false } as a story parameter in your stories. Example:

<Canvas>
    <Story
        name="Main demo"
        parameters={{
            docs: { source: { type: 'code' } },
            chromatic: { disableSnapshot: false },
        }}
    >
        <BannerExamples theme="light" />
    </Story>
</Canvas>

We recommend you enable these tests on those Storybook stories that have several different variants of the component under testing. Enabling them on one or two stories per component should be sufficient in most cases (there's no need to enable them on all stories).

Review tests

When you open a GitHub PR, you'll notice the "UI Review" and "UI Tests" CI steps.

  • Clicking on "Details" will bring you to the Chromatic UI (if you don't already have a Chromatic account, please sign-up using your GitHub account).
  • Now you can review and accept your changes (or go back and change your code).
  • When you're happy with your changes, make sure to mark them as "Approved".

Releasing

This project uses semantic-release to automate version management and package publishing.

How it works

  1. Make your changes using Conventional Commits:

    • Any type below with an added ! suffix (e.g. feat!:, fix!:) or a BREAKING CHANGE: footer for breaking changes (major version bump)
    • feat: for new features (minor version bump)
    • fix: for bug fixes (patch version bump)
    • perf: for performance improvements (patch version bump)
    • refactor: for refactoring code
    • test: for adding/updating tests
    • build: for build/dependency changes
    • docs: for documentation changes
    • ci: for CI changes
    • revert: for reverting previous commits
    • chore: for maintenance tasks (NOTE: these are not included in the changelog)

    Any type can carry an optional scope, e.g. feat(button): or perf(tooltip)!:.

  2. When a PR is merged to main, the Package Release workflow runs and semantic-release:

    • Reads the merged commit's conventional-commit type to determine the version bump
    • Updates CHANGELOG.md, package.json, and package-lock.json, and commits them back to main
    • Creates a new tag and GitHub release
    • Publishes the package to npm and GitHub Packages

A merge triggers a release only when it includes a type marked with a version bump above; otherwise nothing is published.

The storybook hosted on GitHub pages will be automatically updated on each push to main. If there's a problem, try running the action manually from the Actions settings.

Thanks

Chromatic

Thanks to Chromatic for providing the visual testing platform that helps us review UI changes and catch visual regressions.

版本与发布记录

@doist/reactist 共发布 374 个版本,首次发布于 2017/05/08;过去 12 个月发布了 44 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
37.4.0latest2026/09/082 个月前
37.3.12026/08/282 个月前
37.3.02026/08/272 个月前
37.2.02026/08/202 个月前
37.1.02026/08/202 个月前
37.0.02026/08/192 个月前

关于 @doist/reactist 的常见问题

@doist/reactist 是什么?

Open source React components by Doist

如何安装 @doist/reactist?

在项目目录运行 npm install @doist/reactist,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@ariakit/react(~0.4.19)、classnames(^2.2.5)、react(>=18.0.0 <20.0.0)、react-compiler-runtime(^1.0.0)、react-dom(>=18.0.0 <20.0.0)、react-transition-group(^4.4.5)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@doist/reactist 支持 TypeScript 吗?

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

@doist/reactist 支持 ESM 还是 CommonJS?

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

@doist/reactist 需要什么版本的 Node.js?

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

@doist/reactist 可以商用吗?

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

@doist/reactist 的下载量有多少?

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

@doist/reactist 还在维护吗?

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