@alixpartners/ui-components

中文文档
3.7.2发布于 2026/10/22SEE LICENSE IN LICENSE.mdTypeScriptES Module近 30 天下载 5152

A reusable React component library aligned with the AlixPartners Design System.

原始使用文档
文档目录15 节
  1. What’s new in 3.x
  2. Version support
  3. React support
  4. Useful links
  5. Installation
  6. Usage
  7. Components
  8. Design tokens
  9. Landing a Tokens Studio export
  10. Regenerating locally
  11. Build
  12. Using a local build in another project
  13. Testing
  14. Publishing
  15. Contributing

AlixPartners UI Component Library

A reusable React component library aligned with the AlixPartners Design System.

Published as @alixpartners/ui-components on npm. The current major is 3.x.

What’s new in 3.x

  • React 19 support alongside React 18.3+ — consuming apps are not forced to upgrade React
  • Automatic npm publish on merge to main, with Slack release notes
  • Composite tokens — typography from Figma lands as SCSS mixins (@mixin ap-*) that apply the full text style (size, weight, line-height, letter-spacing, transform), not one-off hardcoded values
  • Design tokens, icon web-font, and illustrations generated in-repo from Figma, with automated PRs when the design system changes
  • ESM library build (Vite 6) with CSS injected into the bundle — no separate stylesheet import
  • Storybook 9 as the component workshop
  • CI unit-tested and built against both React 18 and React 19
  • Icon font ships woff / woff2 only (legacy .eot / .svg formats dropped)

Version support

LineStatus
v3.xCurrent — production
v2.xPrevious major
v1.xLegacy only (critical fixes)

3.0 is not backwards compatible with 1.x. Existing 1.x apps can stay on that line. New work should use 3.x.

React support

Peer dependencies accept React ^18.3.1 || ^19.0.0, so apps can stay on 18.3 or move to 19.

React versionSupported
18.3+Yes
19.xYes
ResourceURL
Design system docsPlatforms Design System
Storybookapuilibdev.azurewebsites.net
npm@alixpartners/ui-components
FigmaPlatforms Design System
Slack#platforms-components-library

Installation

npm install @alixpartners/ui-components

Install the peer dependencies if the consuming app does not already have them:

npm install react@^18.3.1 react-dom@^18.3.1

React 19 is equally valid:

npm install react@^19.0.0 react-dom@^19.0.0

radix-ui and notistack ship with the package (kept external at build time so they can share runtime state with an app that also uses them). You do not need to install them separately unless you want a top-level copy for your own code.

Styles (including the icon font and design-system tokens) are bundled with the package. You do not need a separate CSS import.

The package is ESM-only. Import it from ESM / bundler code (import), not require().

Usage

import { Button } from '@alixpartners/ui-components'

function App() {
  return (
    <Button type="primary" variant="default">
      Click me
    </Button>
  )
}

ToastProvider (and useToast) wrap the app once:

import { ToastProvider, useToast } from '@alixpartners/ui-components'

function App() {
  return (
    <ToastProvider>
      <Page />
    </ToastProvider>
  )
}

Components

Explore every component, variant, and prop in Storybook. Public exports include:

GroupComponents
ActionsButton, SplitButton
InputsInput, Textarea, Checkbox, Radio, RadioGroup, Toggle, Search, Datepicker, Dropdown, Creatable, TagsFields, RichTextEditor
FeedbackBanner, Toast, ToastProvider, useToast, Tooltip, Dialog, Spinner, Ghost
NavigationNavBar, CorusHeader, Breadcrumb, Tab, TabNavigation
FilesFilePicker, DragAndDrop
DisplayTag, Icon, Illustration

Browse the hosted Storybook, or run it locally:

npm run storybook

Design tokens

Tokens, the icon web-font, and illustrations are generated from Figma inside this repo (design-tokens/). A pipeline syncs design-system changes and opens a PR against development.

Atomic tokens (colors, spacing, sizes) become $ap-* SCSS variables. Composite tokens — currently typography — become @mixin ap-* mixins so a component can apply a whole text style in one include, for example @include ap-button-md-contained.

Landing a Tokens Studio export

When UX exports tokens from Figma (Tokens Studio multi-file .zip), run /sync-design-tokens in Claude Code or Cursor with this repo open. Attach the zip and the design-system version (e.g. 1.5.0). The command unpacks the export into design-tokens/tokens/, rebuilds src/assets/_variables.scss, repairs broken $ap-* consumer refs, and opens a PR against development on design-tokens/<version>.

/sync-design-tokens
/sync-design-tokens 1.5.0
/sync-design-tokens --sync          # also refresh icons/illustrations from Figma
/sync-design-tokens --dry-run       # unpack + rebuild + report; no commit/push/PR

The zip must contain $metadata.json (folder / multi-file export), not a lone tokens.json. Claude Desktop does not load repo slash commands — use Claude Code or Cursor, or follow .claude/skills/sync-design-tokens/SKILL.md with the zip attached.

Regenerating locally

npm run tokens:build    # parse JSON tokens → SCSS (no Figma secrets)
npm run tokens:sync     # fetch from Figma, rebuild font + SCSS + illustrations
npm run tokens:verify   # fail if src/assets/_variables.scss has drifted

See design-tokens/README.md for inputs, outputs, and the surprises (positional icon codepoints, non-reproducible font binaries, typography mixins).


Build

npm run build

Output lands in dist/. The published entry is dist/main.js (ESM) with types at dist/main.d.ts.

Using a local build in another project

# In this repo:
npm link

# In the consuming project:
npm link @alixpartners/ui-components

Then import from @alixpartners/ui-components as usual.


Testing

CI runs unit tests and a production build against React 18.3.1 and React 19.1.0.

npm run test              # Vitest (unit + Storybook projects)
npm run test:unit         # unit tests only (happy-dom)
npm run test:storybook    # Storybook interaction tests
npm run test:playwright   # Playwright e2e
npm run coverage          # Vitest coverage

Publishing

Do not publish by hand. Merging to main publishes @alixpartners/ui-components to the public npm registry.

  1. Bump the version in package.json, package-lock.json, and CHANGELOG.md (on development)
  2. Open a pull request from development → main
  3. When the PR is merged, .pipelines/publish-prod.yml builds the library, runs npm publish --access public, and posts the changelog to Slack

The pipeline needs secret variables NPM_TOKEN (npm automation token with publish rights for @alixpartners) and SLACK_WEBHOOK_URL.

Package: npmjs.com/package/@alixpartners/ui-components


Contributing

See CONTRIBUTING.md for the process and component structure. Open pull requests against development.

版本与发布记录

@alixpartners/ui-components 共发布 356 个版本,首次发布于 2019/02/05;过去 12 个月发布了 53 个版本。

版本发布日期距今
3.7.2latest2026/10/2216 天前
3.7.12026/10/2019 天前
3.7.02026/10/1722 天前
3.6.02026/10/0830 天前
3.5.12026/10/011 个月前
3.5.02026/09/281 个月前

其他发布通道:beta → 2.0.0-beta.18.4。

关于 @alixpartners/ui-components 的常见问题

@alixpartners/ui-components 是什么?

A reusable React component library aligned with the AlixPartners Design System.

如何安装 @alixpartners/ui-components?

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

@alixpartners/ui-components 支持 TypeScript 吗?

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

@alixpartners/ui-components 支持 ESM 还是 CommonJS?

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

@alixpartners/ui-components 可以商用吗?

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

@alixpartners/ui-components 的下载量有多少?

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

@alixpartners/ui-components 还在维护吗?

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