@aws-northstar/ui

中文文档
1.4.2发布于 2025/03/27Apache-2.0TypeScriptCommonJS近 30 天下载 5045

NorthStar Design System v2

原始使用文档
文档目录8 节
  1. Before you start
  2. Installation
  3. Use in your React Project
  4. Setup
  5. Usage
  6. Support
  7. Sourcecode
  8. Changelog

NorthStar - Prototyping Design System

NorthStar is an open source design system with reusable React components for rapidly prototyping intuitive, meaningful and accessible user experience. It simplifies your work and ensures consistent, predictable user experience at scale for your customers. With NorthStar, you can focus on innovation and do more with less.

Whether you are a developer or a designer, NorthStar will help you delight your customers from inception to prototype.

NorthStar v2 improves upon the previous version by leveraging Cloudscape Design System and with updates to the existing components with new features that make the development experience even better.

Before you start

Before you start using NorthStar for your project, please note that:

  • NorthStar currently only supports the React framework. It supports the most recent versions of React, starting from 18.

  • NorthStar supports the latest, stable releases of modern browsers - Chrome, Firefox and Safari.

  • NorthStar is shipped with the Apache 2.0 License.

Installation

Use in your React Project

// with npm
npm install @aws-northstar/ui
npm install @cloudscape-design/components

// with yarn
yarn add @aws-northstar/ui
yarn add @cloudscape-design/components

Setup

At the very top of your application, import the NorthStarThemeProvider component and render the NorthStarThemeProvider component.

import NorthStarThemeProvider from '@aws-northstar/v2/components/NorthStarThemeProvider';

export default () => (
    <NorthStarThemeProvider>
        ...redux provider, Apollo client provider, react router...
    </NorthStarThemeProvider>
);

Usage

Here is a quick example to get you started to add a form with one input field to your app:

import React, { FC } from 'react';
import FormRenderer, { componentTypes, validatorTypes } from '@aws-northstar/ui/components/FormRenderer';

const MyComponent: FC = () => (
    <FormRenderer 
        onSubmit={console.log} 
        onCancel={console.log}
        schema={
            header: 'Submission Form',
            fields: [
                {
                    component: componentTypes.TEXT_FIELD,
                    name: 'email',
                    label: 'Email',
                    description: 'Email Address',
                    helperText: 'Enter a valid email address',
                    isRequired: true,
                    validate: [
                        {
                            type: validatorTypes.REQUIRED,
                        },
                        {
                            type: validatorTypes.PATTERN,
                            message: 'Invalid email address',
                            pattern: /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i,
                        },
                    ],
                },
            ],
        }
    />
);

export default MyComponent; 

This documentation website has detailed examples on how to use each component.

To learn React, check out the React documentation.

Support

We use GitHub Issues as a bug tracker. If you think you have found a bug, please follow the Submitting bugs section in the Contribution Guide and open an issue with detailed information about the issue.

Sourcecode

If you are interested in our source code, our repo is at https://github.com/aws/aws-northstar.

Changelog

Check out the Changelog

版本与发布记录

@aws-northstar/ui 共发布 22 个版本,首次发布于 2023/03/19;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.4.2latest2025/03/271.6 年前
1.4.12025/03/261.6 年前
1.1.132023/10/313 年前
1.1.122023/09/273 年前
1.1.112023/09/223 年前
1.1.102023/09/213 年前

关于 @aws-northstar/ui 的常见问题

@aws-northstar/ui 是什么?

NorthStar Design System v2

如何安装 @aws-northstar/ui?

在项目目录运行 npm install @aws-northstar/ui,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@cloudscape-design/components(^3)、@tanstack/react-query(^4.35.3)、@types/react(^18)、@types/react-dom(^18)、@types/react-router-dom(^5)、react(^18)、react-dom(^18)、react-router-dom(^6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@aws-northstar/ui 支持 TypeScript 吗?

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

@aws-northstar/ui 支持 ESM 还是 CommonJS?

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

@aws-northstar/ui 可以商用吗?

@aws-northstar/ui 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aws-northstar/ui 的下载量有多少?

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

@aws-northstar/ui 还在维护吗?

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