The design system is a set of open source design and front-end development resources for creating Section 508 compliant, responsive, and consistent websites. It builds on the U.S. Web Design System and extends it to support additional CSS and React components, utility classes, and a grid framework to allow teams to quickly prototype and build accessible, responsive, production-ready websites.
You're currently at the root of a monorepo containing multiple NPM packages located in the packages
directory. Unless you're a contributor or a child design system maintainer, you can ignore the @cmsgov/design-system-docs
and @cmsgov/design-system-scripts
packages, as they are mostly focused on the design system's developer tooling and documentation. View the README.md
in each of these for additional details.
Name | Description |
---|---|
CMS Design System | The core CSS, JS, and React components for the design system. |
Design System Documentation | Markdown files containing documentation for the core design system site. These files are used by @cmsgov/design-system-scripts to generate our documentation site. |
Design System Scripts | Scripts for compiling, testing, and linting design system assets. Also contains scripts for building and serving the documentation site. This is used internally by the core CMS design system team, but is made public for child design systems. |
Healthcare.gov Design System | Design system used by application teams at healthcare.gov |
Medicare.gov Design System | Design system used by application teams at medicare.gov |
This project uses Yarn for package management. Yarn helps to ensure everyone is using the same package versions. Install Yarn, if you don't have it yet.
yarn install
- This will also run Lerna
bootstrap
which allows us to have multiple packages within the same repo (a monorepo). Lerna installs all our dependencies and symlinks any cross-dependencies.
- This will also run Lerna
yarn start
Note: When you create a Git commit, any staged scripts will be automatically ran through ESLint and Prettier. If the linter catches an error, your commit will fail. This is a feature, not a bug :)
These scripts can all be run from the root level of the repo:
yarn start
- Starts local server running the documentation site
- Regenerates documentation when files change
yarn start:healthcare
to start the Healthcare.gov Design System's documentation siteyarn start:medicare
to start the Medicare.gov Design System's documentation site
yarn build
- Compile/transpile/uglify everything and makes things release-ready.
yarn build:healthcare
to build the Healthcare.gov Design Systemyarn build:medicare
to build the Medicare.gov Design System
yarn build-docs
- Build the design system and the documentation site
yarn build-docs:healthcare
to build the Healthcare.gov Design System docs siteyarn build-docs:medicare
to build the Medicare.gov Design System docs site
yarn storybook
- Starts storybook for easier local development for the core package
yarn storybook:healthcare
starts storybook for healthcare stories & stylesyarn storybook:medicare
starts storybook for medicare stories & styles
yarn test
- Runs JS unit tests
- Runs Prettier for formatting
- Lints JS using ESLint
- Lints Sass using stylelint
yarn test:unit
- Runs JS unit tests for all packages
yarn test:a11y
- Runs accessibility tests for design-system package only
yarn test:a11y:healthcare
to run the Healthcare.gov Design System's accessibility testsyarn test:a11y:medicare
to run the Medicare.gov Design System's accessibility tests
yarn update-snapshots
- Updates Jest snapshots
yarn lint
- Runs just the linting portion of the tests
yarn release
- Bumps package versions and tags a release commit. Read our Release Process guide for more info.
yarn publish-release
- Publishes npm packages. Read our Release Process guide for more info.
In addition to unit and a11y tests, we're using backstopJS for visual regression testing. Here's how to run the tests.
- Install backstopJS
yarn install
- Run the site locally
yarn start
- In a new terminal window run the backstop tests
backstop test
- This will test the local CMSDS documentation site against the CMSDS production documentation site
- After the tests run an html report will open in your browser showing passed and failed tests
- When introducing a visual change, run
backstop approve
to commit new reference files after confirming the change withbackstop test
Note: Use backstop reference
to update and replace all reference files.
The CMS Design System provides a Sketch file and Sketch Library containing components, styles, and symbols. These are regularly updated alongside our code, and updates are automatically synced for designers using the Sketch Library.
Read more on using Sketch with the CMS Design System
Examples of the design system in use can be found in the examples
directory.
Please read the CONTRIBUTING.md document to learn about contributing to the design system, and our coding guidelines.
To contact the CMS Design System product owners, please email [email protected]
One of our goals is to ensure a welcoming environment for all contributors. Please take a look at our Code of Conduct to learn more.