@formio/uswds

中文文档
2.9.6发布于 2026/11/14OSLv3CommonJS零依赖近 30 天下载 2493

US Web Design System templates for form.io

原始使用文档
文档目录4 节
  1. Official Documentation
  2. Usage
  3. Form Builder
  4. Example Application

Form.io United States Web Design System Templates

This repository will change the rendering of forms in formio.js so that it uses html and classes compatible with the United States Web Design System framework.

Official Documentation

For the latest documentation, release information, and guides, always refer to the official Form.io Help Documentation available here:

https://help.form.io

Usage

import uswds from '@formio/uswds';
import { Formio } from '@formio/js';
Formio.use(uswds);

Or if you would like to embed directly within your website, you can use the following.

<html>
  <head>
    <meta charset="UTF-8" />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
    />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/uswds/3.1.0/css/uswds.min.css"
    />
    <link rel="stylesheet" href="https://cdn.form.io/js/formio.form.min.css" />
    <link rel="stylesheet" href="https://cdn.form.io/uswds/uswds.min.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/uswds/3.1.0/js/uswds.min.js"></script>
    <script src="https://cdn.form.io/js/formio.form.min.js"></script>
    <script src="https://cdn.form.io/uswds/uswds.min.js"></script>
  </head>
  <body>
    <div id="formio"></div>
    <script type="text/javascript">
      Formio.use(uswds);
      Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
    </script>
  </body>
</html>

You can try out this by going to the following JSFiddle - https://jsfiddle.net/travistidwell/yrwp9m24/1

Form Builder

In addition to being a Form Renderer, you can also use this library to embed the Form.io Form Builder within your own application using the following.

<html>
  <head>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
    />
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/uswds/3.1.0/css/uswds.min.css"
    />
    <link rel="stylesheet" href="https://cdn.form.io/js/formio.full.min.css" />
    <link rel="stylesheet" href="https://cdn.form.io/uswds/uswds.min.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/uswds/3.1.0/js/uswds.min.js"></script>
    <script src="https://cdn.form.io/js/formio.full.min.js"></script>
    <script src="https://cdn.form.io/uswds/uswds.min.js"></script>
  </head>
  <body>
    <div id="builder"></div>
    <script type="text/javascript">
      Formio.use(uswds);
      Formio.builder(document.getElementById('builder'));
    </script>
  </body>
</html>

Example Application

For an example of how this platform works, please see the following application.

https://formio.github.io/uswds

版本与发布记录

@formio/uswds 共发布 128 个版本,首次发布于 2020/04/04;过去 12 个月发布了 24 个版本。

版本发布日期距今
2.9.6latest2026/11/142 天前
2.9.52026/10/101 个月前
2.9.42026/09/231 个月前
2.9.32026/09/171 个月前
2.9.22026/08/272 个月前
2.9.1-pdf515.02026/08/113 个月前

其他发布通道:2_3_x → 2.3.9-rc.2,2_5_x → 2.5.2-rc.1,dev → 2.7.0-dev.264.6eeac53,rc → 2.6.1-rc.1。

关于 @formio/uswds 的常见问题

@formio/uswds 是什么?

US Web Design System templates for form.io

如何安装 @formio/uswds?

在项目目录运行 npm install @formio/uswds,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@formio/js(^5.7.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@formio/uswds 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/formio__uswds 是否存在。

@formio/uswds 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@formio/uswds 可以商用吗?

@formio/uswds 使用 OSLv3 许可。声明的许可为 OSLv3,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@formio/uswds 的下载量有多少?

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

@formio/uswds 还在维护吗?

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