Giter Site home page Giter Site logo

awsui-documentation's Introduction

Getting started with AWS UI Components

Introduction

In 2017, AWS launched the AWS Design System to unify the customer experience across a vast portfolio of AWS services. The AWS Design System consists of human interface guidelines and user interface components that ensure a consistent, predictable experience for all AWS customers. It includes AWS UI—a collection of more than 50 React components that help create intuitive, responsive, and accessible interfaces for web applications.

AWS released the AWS UI components to NPM under the Apache 2.0 open source license in December 2020. In continuing with this release, we want to share the AWS Design System with the wider community. Anyone inside or outside of AWS looking to build custom experiences or projects can use the design system to meet their needs. This release is being staggered—so the rest of the system, including the documentation, will not be fully open sourced until early 2022.

This guide provides a short introduction on how to use the AWS UI components.

Prerequisites

  • Familiarity with building React applications and using NPM modules.
  • An existing React application (for example, created using Create React App).

What's in the packages?

This is the main AWS UI package that contains the actual components. They're React components, with TypeScript definitions included, so this is the best place to start exploring.

In this package, you'll find global typography-related styles, including the Noto Sans font and base font sizes. Make sure you import it once into every AWS UI application to ensure consistent styling.

A set of React hooks that you can use to control the state of the Table and Cards components (as well as related components, such as TextFilter and Pagination).

With this package, you'll get a set of design tokens in a variety of formats, which you can use to build custom components that are visually consistent with the AWS Design System.

This internal package is used to create utilities for writing unit and integration tests.

Using the components

Step 1: Include the AWS UI Global Styles package

The AWS UI Global Styles package contains global styles for AWS UI components, including the Noto Sans font and base font sizes.

1. Install the package by running the following command:

npm install @awsui/global-styles

2. Include the styles in your application by adding the following import to the main component/page of your application:

import "@awsui/global-styles/index.css"

Step 2: Install the the AWS UI React components

1. Install the package by running the following command:

npm install @awsui/components-react

2. Import a component using the following syntax:

import ComponentName from "@awsui/components-react/{component-name}"

For example, to import the Button component:

import Button from "@awsui/components-react/button"

After you import it, you can use the component as you would any other React component:

<Button>Hello!</Button>

Note: You can import components using the following syntax, but this might result in a larger overall bundle size:

import { Button } from "@awsui/components-react"

Step 3: View component properties

You can find a full list of components and documentation for those components' properties in the components folder.

We also use TypeScript definitions to document component properties. If you're using a TypeScript-aware editor (such as VSCode) you should see the full list of components, their available properties, and property types/accepted values via autocomplete/IntelliSense.

Step 4: Build an example form

Now that you've downloaded and installed the component packages, you can get started building user interfaces. This walkthrough demonstrates how to use these components together by showing you how to build a simple form.

An example form interface

To build a form to capture user input, we recommend that you combine the following components:

  • Form – Provides the basic form structure, including header and actions slots for action buttons.
  • Container – Holds a group of related pieces of content, showing users that the items are related.
  • Header – Provides styling for header elements.
  • SpaceBetween – Adds consistent spacing between elements on your page.
  • FormField – Enables you to associate labels and descriptions with controls such as text inputs and selects.
  • Input – Provides a text input control, similar to the HTML <input> tag.
  • Select – Provides a select control, similar to the HTML <select> tag.

You can find a full working example using these components in the example folder.

Where can I find more documentation?

You can find a full list of components and documentation for those components' properties in the components folder. Component properties are also documented via TypeScript definitions. If you’re using a TypeScript-aware editor (such as VSCode) you should see the full list of components, their available properties, and property types/accepted values via autocomplete/IntelliSense.

Having problems?

Contact us by opening an issue.

Security

See CONTRIBUTING for more information.

License Summary

The documentation is made available under the Creative Commons Attribution-ShareAlike 4.0 International License. See the LICENSE file.

The sample code within this documentation is made available under the MIT-0 license. See the LICENSE-SAMPLECODE file.

awsui-documentation's People

Contributors

dependabot[bot] avatar gethinwebster avatar just-boris avatar abdhalees avatar amazon-auto avatar johannes-weber avatar michaeldowseza avatar rubencarvalho avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.