# @aurodesignsystem-dev/auro-button 中文文档

规范地址：https://npmcn.com/package/%40aurodesignsystem-dev/auro-button/

版本：0\.0\.0-pr448\.1
npm 元数据更新时间：2026-11-03T19:49:21.584Z
中文译文更新时间：2026-11-07T05:24:19.147Z
软件包许可：Apache-2\.0

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

原始 npm 页面：https://www.npmjs.com/package/%40aurodesignsystem-dev/auro-button
原文对照：https://npmcn.com/package/%40aurodesignsystem-dev/auro-button/?lang=original
项目主页：https://github.com/AlaskaAirlines/auro-button#readme
源码仓库：https://github.com/AlaskaAirlines/auro-button

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

- 包体积（解压后）：773 kB，22 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=20
- 运行依赖：1 个
- 首次发布：2025-09-30T00:14:16.031Z
- 最新版本发布：2026-11-03T19:49:21.229Z
- 近 30 天下载量：3353（2026-10-07 至 2026-11-05，npm 官方下载统计）
- 已发布版本数：133（近 12 个月 113 个）

## 中文简介

Auro 自定义 auro 按钮元素

## 安装

```sh
npm install @aurodesignsystem-dev/auro-button
```

也可以使用：`pnpm add @aurodesignsystem-dev/auro-button`、`yarn add @aurodesignsystem-dev/auro-button`、`bun add @aurodesignsystem-dev/auro-button`

## README

# 按钮

一个可访问的按钮,让人们采取行动,比如提交一个表单,开始一个任务,或者移动到流中的下一步.

## 宽度

`<auro-button>` 和屏幕大小一样宽 装满容器的全宽度,比如小屏幕上 `fluid`。 。 。 .

## 使用大小写

使用 `<auro-button>` 当人们需要:

-   提交表格.
-   开始新的任务 .
-   打开界面的新部分, 如对话框 .
-   移动到进程下一步 .

## 安装

[![Build Status](https://img.shields.io/github/actions/workflow/status/AlaskaAirlines/auro-button/release.yml?style=for-the-badge)](https://github.com/AlaskaAirlines/auro-button/actions/workflows/release.yml) [![See it on NPM!](https://img.shields.io/npm/v/@aurodesignsystem/auro-button?style=for-the-badge&color=orange)](https://www.npmjs.com/package/@aurodesignsystem/auro-button) [![License](https://img.shields.io/npm/l/@aurodesignsystem/auro-button?color=blue&style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0) ![ESM supported](https://img.shields.io/badge/ESM-compatible-FFE900?style=for-the-badge)

```shell
$ npm i @aurodesignsystem/auro-button
```

### 定义项目中的依赖性

导入每个项目中使用的组件 `<auro-button>`。 。 。 .

```js
import "@aurodesignsystem/auro-button";
```

### 使用 CDN 软件

如果你的项目不能处理JS资产,使用预先处理的资产. IE11等后遗症浏览器不支持.

```html
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/+esm"></script>
```

## 基本实例

```html
<auro-button>Primary</auro-button>
<auro-button variant="secondary">Secondary</auro-button>
<auro-button variant="tertiary">Tertiary</auro-button>
<auro-button variant="ghost">Ghost</auro-button>
```

## 自定义版本管理组件注册

每个Auro组件有两个关键部分: [类](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) 和自定义元素定义. 类定义了组件的行为,而自定义元素则以特定的名称注册,以便用于HTML.

安装安装部分中描述的组件, 导入此类, 并为您在全球注册该组件 .

然而,如果需要在同一页上加载多个版本的同构件(例如两个项目依赖于不同的版本),则在自定义元素名下手动注册该类以避免冲突.

要做到这一点,只需导入组件类并调用 `register(name)` 唯一名称的方法 :

```js
// Import the class only
import { AuroButton } from '@aurodesignsystem/auro-button/class';

// Register with a custom name if desired
AuroButton.register('custom-button');
```

创建新的自定义元素 `<custom-button>` 行为就像 `<auro-button>`,允许两者在同一页上共存,而互不干涉.

小学 中学 高等教育

见代码

```html
<custom-button>Primary</custom-button>
<custom-button variant="secondary">Secondary</custom-button>
<custom-button variant="tertiary">Tertiary</custom-button>
```

## 常见问题

### @aurodesignsystem-dev/auro-button 是什么？

Auro 自定义 auro 按钮元素

### 如何安装 @aurodesignsystem-dev/auro-button？

在项目目录运行 npm install @aurodesignsystem-dev/auro-button，或使用 pnpm add / yarn add / bun add。

### @aurodesignsystem-dev/auro-button 支持 TypeScript 吗？

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

### @aurodesignsystem-dev/auro-button 支持 ESM 还是 CommonJS？

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

### @aurodesignsystem-dev/auro-button 需要什么版本的 Node\.js？

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

### @aurodesignsystem-dev/auro-button 可以商用吗？

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

### @aurodesignsystem-dev/auro-button 的下载量有多少？

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

### @aurodesignsystem-dev/auro-button 还在维护吗？

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

