@aragon/ui

中文文档
1.9.3发布于 2021/10/23MITESM + CJS近 30 天下载 4201

aragonUI

原始使用文档
文档目录7 节
  1. Overview
  2. Getting Started
  3. Quick setup
  4. Assets
  5. Build and Develop
  6. Projects using aragonUI
  7. License

aragonUI

Overview

aragonUI is a React library used to build user interfaces for Aragon and its related projects. It provides the components needed to build experiences that feel integrated with Aragon ecosystem, and can be used both client or server side.

The complete documentation can be found on the aragonUI website.

Getting Started

If you are unfamiliar with aragonUI, we recommend you to start with the getting started page. If you only want to know how to add aragonUI to your project, have a look at the quick setup:

Quick setup

Install aragonUI alongside styled-components from npm:

npm install --save @aragon/ui styled-components

Copy its assets into your public directory:

npx copy-aragon-ui-assets ./public

Wrap your app with the Main component:

import React from 'react'
import { Main } from '@aragon/ui'

function App() {
  return (
    <Main>
      <h1>Hello aragonUI!</h1>
    </Main>
  )
}

Your project is now ready to use aragonUI. 💫

Open https://ui.aragon.org/ to see the list of the available components and learn how to use them.

Assets

aragonUI require some assets (e.g. fonts) in order to work properly. These need to be copied where they can be accessed by the library, like the public/ directory of a project using Create React App.

Copy these assets using the provided copy-aragon-ui-assets command:

npx copy-aragon-ui-assets ./public

By default, it will create a directory named aragon-ui in the specified directory.

This emplacement is communicated to the library through the <Main> component. The default path is ./aragon-ui/, but you can change it using the assetsUrl prop:

import { Main } from '@aragon/ui'

const App = () => (
  <Main assetsUrl="http://example.com/aragon-ui-assets/">
    <h1>Hello aragonUI!</h1>
  </Main>
)

You may also want to add it as a build step in your project, so that aragonUI can be upgraded without having to worry about this.

"scripts": {
  "sync-assets": "copy-aragon-ui-assets ./public",
  "build": "npm run sync-assets && react-scripts build",
  "start": "npm run sync-assets && react-scripts start"
}

See copy-aragon-ui-assets -h for more information.

Build and Develop

Please have a look at CONTRIBUTING.md.

Projects using aragonUI

License

MIT, see LICENSE.

版本与发布记录

@aragon/ui 共发布 102 个版本,首次发布于 2017/10/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.9.3latest2021/10/235 年前
1.9.22021/10/085 年前
1.9.12021/10/085 年前
1.9.02021/08/305 年前
1.8.02021/08/175 年前
1.7.02020/08/216 年前

其他发布通道:next → 1.0.0,treeshaking → 0.0.0-treeshaking2。

关于 @aragon/ui 的常见问题

如何安装 @aragon/ui?

在项目目录运行 npm install @aragon/ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.3.1)、react-dom(^16.3.1)、styled-components(>=4.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 copy-aragon-ui-assets,可以用 npx copy-aragon-ui-assets 直接运行。

@aragon/ui 支持 TypeScript 吗?

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

@aragon/ui 支持 ESM 还是 CommonJS?

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

@aragon/ui 需要什么版本的 Node.js?

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

@aragon/ui 可以商用吗?

@aragon/ui 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@aragon/ui 的下载量有多少?

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

@aragon/ui 还在维护吗?

最新版本 1.9.3 发布于 2021/10/23(5 年前);至今共发布 102 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/10/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。