govuk_publishing_components icon indicating copy to clipboard operation
govuk_publishing_components copied to clipboard

A gem to document and distribute frontend components for GOV.UK applications

GOV.UK Publishing Components

status JavaScript Style Guide Stylelint Style Guide

A Ruby gem to document and distribute components for GOV.UK applications. It provides:

  • a shared library of components
  • helpers to generate component payloads
  • an application to preview components and provide guidance
  • GOV.UK Design System styles and components (via GOV.UK Frontend)

Components should be added to this gem if they are required in more than one application, otherwise they should be added to that application. All components should meet the same standards of browser and assistive technology support described in GOV.UK Frontend.

Technical documentation

You can use the GOV.UK Docker environment or the local startup.sh script to run the app. Read the guidance on local frontend development to find out more about each approach, before you get started.

If you are using GOV.UK Docker, remember to combine it with the commands that follow. See the GOV.UK Docker usage instructions for examples.

Running the test suite

bundle exec rake

To run JavaScript tests (only):

# run JS tests in browser
yarn run jasmine:browser

# run JS tests on command line
yarn run jasmine:ci

Using the gem

  • Install and use this gem
  • Use a component in your application

Managing the gem

  • Publish/release a new version of the gem
  • Keep this gem in sync with the Design System
  • Move a component from an application to the gem

Making components

  • Generate a new component
  • Component conventions
  • Component principles

Further documentation

More documentation can be found in the docs directory.

Licence

MIT Licence