Socket
Socket
Sign inDemoInstall

@trussworks/react-uswds

Package Overview
Dependencies
Maintainers
5
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trussworks/react-uswds

React USWDS 2.0 component library


Version published
Weekly downloads
6.8K
decreased by-9.58%
Maintainers
5
Weekly downloads
 
Created
Source

@trussworks/react-uswds

CircleCI

Summary

This is a front end component library whose aim is to develop React implementations of the design patterns defined by the United States Web Design System (USWDS) 2.0. The primary goal of this library is to document and provide common UI components that can be included in other projects that adhere to or are based off of the USWDS, removing a significant amount of overhead UI development from such projects.

Table of Contents

  1. Goals
  2. Contributing
  3. Usage
  4. Using SCSS

Goals

The primary deliverable is a published npm package that can be included as a dependency in other projects that use USWDS with React. In order for these components to be actually useful, they should follow best practices and baseline standards for accessible, semantic, markup; be well-tested across browsers and devices; and allow for an appropriate level of customization in implementation (such as via React props). Therefore we should adhere to these development guidelines as much as possible:

  • Encourage a strict separation of concerns, focusing on UI (rendered HTML and CSS) rather than any application logic.
  • Expose the necessary props for composability and extensibility, such as event handlers, custom CSS classes, etc.
  • Maintain a high standard of unit test coverage and cross-browser/device support, so that projects including this depedency can focus on integration and implementation.
  • Provide thorough documentation (using a web interface such as Storybook) so that users can view the components as they render in the UI, the source code required to use them, and specifications such as how props are used, a11y support, and test coverage.
  • Consistent and transparent versioning so that multiple projects can rely on this package, and it can be maintained as React and USWDS release new versions while also providing backwards compatibility.

Non-Goals

This is not meant to be a one-size-fits-all front end solution to every Truss web project. We are starting off with the very opinionated decision to cater towards a project that wants to use (or at least branch off of) USWDS 2.0, and is using React as a front end framework.

In addition to working towards the above outcomes, we are hoping to gain learnings around how to best abstract out UI code from implementation; help demonstrate and standardize front end code practices for other Truss projects; and develop and distribute a shared JS library to other teams.

Usage

Install this package with npm or yarn:

yarn add @trussworks/react-uswds

npm install @trussworks/react-uswds

You can then import modules using ES6 syntax:

import { Alert } from '@trussworks/react-uswds'

Also make sure to include the following in order to import the compiled CSS from this project:

@import '~@trussworks/react-uswds/lib/index.css';

More info about using USWDS CSS & SCSS

Roadmap

  • Add lint configs and pre-commit hooks for contributing
  • Set up CI for running tests and linting
  • Add support for and convert existing component(s) to TypeScript
  • Decide on and document git workflow for this project
  • Decide on and document release workflow for the package
  • Load and export USWDS CSS
  • Load and export USWDS fonts/svgs/other assets
  • Decide on long-term lib publishing/hosting solution
  • Add CI status badge
  • Document decision behind node version and upgrade plan
  • ADR to decide on and set up a React component test helper:
  • Enable pkg.module entrypoint for better module and tree shaking:
  • Add more documentation around how to contribute and write new components
  • Add component scaffolding shortcut (for generating component, tests, stories files with template code)
  • Add testing coverage collection
  • Set up Storybook as public Github page
  • Add example application that uses the library to the repo
  • Setup https://danger.systems/js/ to check on contribution standards, possibly even checking yarn install for warnings
  • Add visual testing automation tool (i.e., Loki)
  • Enforce adding to CHANGELOG when merging a PR into develop
  • Make sure new components are added as package exports

Keywords

FAQs

Package last updated on 30 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc