Home

Awesome

govuk-webcomponents

A set of encapsulated Web Components consuming the GOV.UK Design System.

npm

Please note this package is not affiliated to GOV.UK but consumes code as distributed in the govuk-frontend npm package (v3.8.0).

Installation

npm install --save govuk-webcomponents

Components

Please visit the Storybook site for demos and code examples.

Usage

The web components are distributed as ES modules and can be used with any platform.

Modern browsers (Bare module specifiers)

To quickly try the components import the modules directly in the browser and serve with a process that supports bare module specifier resolution such as es-dev-server.

<body>
  <govukwc-button label="Save and continue"></govukwc-button>
  <script type="module">
    import 'govuk-webcomponents/components/govukwc-button/govukwc-button';
  </script>
</body>

Browsers to IE11 (Compiling to ES5)

To support browsers (down to IE11) a combination of polyfills and build steps will need to be taken.

At a highlevel outline the following is required: