@apipass/design-system

中文文档
8.3.0发布于 2026/11/05TypeScriptESM + CJS近 30 天下载 2374

APIPass React Design System

原始使用文档
文档目录21 节
  1. Resources
  2. Setup
  3. Figma Auth
  4. Code Connect
  5. Connecting this repo to a duplicated Figma file
  6. Structure
  7. src/ui/components
  8. src/ui/compositions
  9. src/ui/hooks
  10. src/ui/icons
  11. src/ui/images
  12. src/ui/layout
  13. src/ui/primitives
  14. src/ui/providers
  15. src/ui/utils
  16. Code Connect and Storybook
  17. Scripts
  18. scripts/component-metadata
  19. scripts/dev-resources
  20. scripts/icons
  21. scripts/tokens

Simple Design System (alpha)

Using Figma's Code Connect.

Simple Design System (SDS) is a base design system that shows how Figma’s Variables, Styles, Components, and Code Connect can be used alongside a React codebase to form a complete picture of a responsive web design system.

SDS is not just another design system in Figma. There are still many gaps between design and development, and SDS provides some best practices for how to bridge them. SDS tries to remain honest about its implications in code, while also offering customizability in design beyond the simple theming layer that is typical of many code-first component libraries.

Whether you’re looking to use SDS to start a new project, or are looking for examples of some common design systems best practices, you'll find tools inside this codebase and design file to steer you in the right direction.

Resources

Setup

Figma Auth

  • Create a Figma API token
    • Add Code Connect scope
    • Add File Read, Dev Resources Write, and Variables scopes if you want to use the integrations in scripts
    • More on scopes
  • Duplicate .env-rename
  • Rename it to .env, it will be ignored from git.
    • Set FIGMA_ACCESS_TOKEN= as your token in .env
    • Set FIGMA_FILE_KEY= as your file's key (grab it from the file URL) in .env

Code Connect

SDS is fully backed by Figma's Code Connect. This includes examples for how to connect primitives, as well as compositions of those primitives for your design system.

This repo utilizes documentUrlSubstitutions in figma.config.json. This allows us to keep our docs Figma file-agnostic and colocates all the Figma file-specific information for easy url swapping. The document URL substitutions are also named in a way that helps you find the associated component without clicking a link. A key <FIGMA_INPUTS_CHECKBOX_GROUP> is broken down as <FIGMA_[PAGE_NAME]_[COMPONENT_NAME]>.

{
  "documentUrlSubstitutions": {
    "<FIGMA_INPUTS_CHECKBOX_GROUP>": "https://figma.com/design/whatever?node-id=123-456"
  }
}

Allows us to have more expressive URLs in our Code Connect docs:

figma.connect(CheckboxGroup, "<FIGMA_INPUTS_CHECKBOX_GROUP>");

Connecting this repo to a duplicated Figma file

With the above in mind, a fresh clone of the Simple Design System Figma file should maintain all the node-ids. The steps should be as follows:

  • Duplicate the Figma Community File
  • Clone this repo
  • Update urls in figma.config.json to point to your Figma file
    • Note: the file keys (eg. J0KLPKXiONDRssXD1AX9Oi) should be the only change in the urls unless you're creating new components, detaching and recreating.
  • Create and set your Figma Auth Token
  • At that point, npx figma connect publish should work and your new file should have Code Connect.

Structure

All components and styles are in src/ui. Within that directory, code is broken down into a few categories.

src/ui/components

APIPASS addition, not part of upstream SDS. Composed, reusable blocks assembled from primitives to solve a specific recurring UI pattern (Card, DataTable, ConfirmDialog, FormModal, PageHeader, Sidebar, Widget/WidgetGrid). Unlike compositions, these carry real app-facing behavior and are meant to be imported directly, not just copied as a layout example.

src/ui/compositions

Example arrangements of primitive components to demonstrate how you might use SDS to build a responsive website.

src/ui/hooks

Custom React hook definitions

src/ui/icons

All icon components. Automatically generated by scripts/icons

src/ui/images

Placeholder images.

src/ui/layout

Layout components. Crucial to SDS layouts, but do not have analogous component in Figma.

src/ui/primitives

The main component library. SDS primitives can't be reduced further into sub components.

src/ui/providers

Custom React provider definitions

src/ui/utils

Custom utilities and utility components

Code Connect and Storybook

All Code Connect docs and Storybook stories follow the same categorization are defined in src/figma and src/stories.

Scripts

Some example integrations are available in scripts directory. They may require additional API scope that your org may or may not have access to. Where possible, there are some plugin examples to help fill gaps.

scripts/component-metadata

  • Scripts to run in the JS Console in Figma
  • Bulk manage descriptions for all components in the file. Instead of making a complicated plugin, you can do this more simply by running scripts directly from the JavaScript console.
  • Copy the contents of scripts/component-metadata/exportComponentJSON.js and run in the console with the file open.
  • There you can modify descriptions more easily.
  • Once you have modified the descriptions, copy the JSON and paste at the top of scripts/component-metadata/importComponentJSON.js as the value of the json variable.
  • Copy all the contents of the import file and run in the console to batch update descriptions for the entire file.
  • This will only update the descriptions. To update Dev Resources, you can use scripts/dev-resources.

scripts/dev-resources

  • npm run script:dev-resources (REST API only)
  • Sets dev resources for all components described in scripts/dev-resources/devResources.mjs to match.
  • Useful when swapping urls in bulk. Requires Dev Resources: Write scope on your REST API token.

scripts/icons

scripts/tokens

  • npm run script:tokens:rest
  • Gets all variables and styles from Figma, and converts them to src/theme.css.
  • Creates scripts/tokens/tokensCodeSyntaxes.js which is a script you can run in the JS console in Figma to update all the variable's codeSyntaxes with CSS that matches this repo.
  • Includes some example plugins for how to get the same data without the Variables REST API.

版本与发布记录

@apipass/design-system 共发布 97 个版本,首次发布于 2026/03/31;过去 12 个月发布了 97 个版本。

版本发布日期距今
8.3.0latest2026/11/052 天前
8.2.02026/11/044 天前
8.1.02026/10/309 天前
8.0.02026/10/299 天前
7.4.72026/10/299 天前
7.4.62026/10/2910 天前

关于 @apipass/design-system 的常见问题

@apipass/design-system 是什么?

APIPass React Design System

如何安装 @apipass/design-system?

在项目目录运行 npm install @apipass/design-system,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.0.0)、react-dom(>=18.0.0)、react-aria-components(>=1.10.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@apipass/design-system 支持 TypeScript 吗?

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

@apipass/design-system 支持 ESM 还是 CommonJS?

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

@apipass/design-system 可以商用吗?

@apipass/design-system 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@apipass/design-system 的下载量有多少?

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

@apipass/design-system 还在维护吗?

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