# @fastsprout/reacd 中文文档

规范地址：https://npmcn.com/package/%40fastsprout/reacd/

版本：0\.3\.0
npm 元数据更新时间：2026-11-01T01:47:39.279Z
中文译文更新时间：2026-11-01T03:22:44.949Z
软件包许可：Apache-2\.0

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40fastsprout/reacd
原文对照：https://npmcn.com/package/%40fastsprout/reacd/?lang=original
项目主页：https://reacd.dev/
源码仓库：https://github.com/FastSprout/Reacd

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：2.1 MB，2585 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=22\.12\.0
- 运行依赖：1 个
- peer 依赖：jotai 3\.0\.1，react 19\.3\.1，react-dom 19\.3\.1
- 首次发布：2026-10-30T12:20:14.882Z
- 最新版本发布：2026-11-01T01:47:39.113Z
- 已发布版本数：5（近 12 个月 5 个）

## 中文简介

一个受约束的、代理驱动的UI契约和React渲染器。

## 安装

```sh
npm install @fastsprout/reacd
```

也可以使用：`pnpm add @fastsprout/reacd`、`yarn add @fastsprout/reacd`、`bun add @fastsprout/reacd`

## README

# reacd

**带有封闭组件契约的声明式React UI。**

[![Release workflow](https://github.com/FastSprout/Reacd/actions/workflows/release.yml/badge.svg)](https://github.com/FastSprout/Reacd/actions/workflows/release.yml) [![npm version](https://img.shields.io/npm/v/@fastsprout/reacd)](https://www.npmjs.com/package/@fastsprout/reacd) [![Apache-2.0 license](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/FastSprout/Reacd/blob/main/LICENSE)

在TSX中组合应用程序视图。渲染器和主题适配器处理HTML、样式和 响应布局;Jotai连接应用程序状态。选择shadcn/ui或Material ui。 模板在不改变视图声明的情况下改变外观。

[文档](https://github.com/FastSprout/Reacd/blob/main/docs/index.md) · [开始](https://github.com/FastSprout/Reacd/blob/main/docs/getting-started.md) · [组件](https://github.com/FastSprout/Reacd/blob/main/docs/components/index.md) · [主题 适配器](https://github.com/FastSprout/Reacd/blob/main/docs/guides/theme-adapters.md) · [状态](https://github.com/FastSprout/Reacd/blob/main/docs/guides/state.md) · [更新日志](https://github.com/FastSprout/Reacd/blob/main/docs/changelog.md) · [贡献](https://github.com/FastSprout/Reacd/blob/main/CONTRIBUTING.md) · [安全](https://github.com/FastSprout/Reacd/blob/main/SECURITY.md)

## 安装

安装 `@fastsprout/reacd` 到现有的React应用中：

```sh
npm install @fastsprout/reacd @fastsprout/reacd-shadcn
```

这个 [入门指南](https://github.com/FastSprout/Reacd/blob/main/docs/getting-started.md) 介绍TypeScript的JSX配置，即提供程序 以及浏览器适配器样式。

## 声明视图

```tsx
import { atom, useAtom } from 'jotai';
import { Text, Toggle, VStack } from '@fastsprout/reacd';

const enabledAtom = atom(false);

export function ToggleExample() {
  const [enabled, setEnabled] = useAtom(enabledAtom);
  return (
    <VStack>
      <Toggle label="Email summaries" checked={enabled} onCheckedChange={setEnabled} />
      <Text>{`Email summaries are ${enabled ? 'enabled' : 'disabled'}.`}</Text>
    </VStack>
  );
}
```

选择 `shadcnAdapter` 从 `@fastsprout/reacd-shadcn` 在你 `ReacdProvider` 根。为 材质UI，安装 `@fastsprout/reacd-mui` 然后选择它 `muiAdapter`． 这是 [可运行切换示例](https://github.com/FastSprout/Reacd/blob/main/docs/examples/toggle.tsx)． 可选 [生成用户界面](https://github.com/FastSprout/Reacd/blob/main/docs/guides/generative-ui.md) 结合 通过显式读或读/写访问将组件转换为类型化状态。

## 许可证

[apache - 2.0](https://github.com/FastSprout/Reacd/blob/main/LICENSE)． 提供的许可证已导入 [第三方通知](https://github.com/FastSprout/Reacd/blob/main/THIRD_PARTY_NOTICES.md).

## 常见问题

### @fastsprout/reacd 是什么？

一个受约束的、代理驱动的UI契约和React渲染器。

### 如何安装 @fastsprout/reacd？

在项目目录运行 npm install @fastsprout/reacd，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：jotai（3\.0\.1）、react（19\.3\.1）、react-dom（19\.3\.1）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @fastsprout/reacd 支持 TypeScript 吗？

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

### @fastsprout/reacd 支持 ESM 还是 CommonJS？

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

### @fastsprout/reacd 需要什么版本的 Node\.js？

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

### @fastsprout/reacd 可以商用吗？

@fastsprout/reacd 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @fastsprout/reacd 还在维护吗？

最新版本 0\.3\.0 发布于 2026/11/01（2 天前）；至今共发布 5 个版本，其中过去 12 个月发布了 5 个；首次发布于 2026/10/30。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

