Skip to content

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

License

Notifications You must be signed in to change notification settings

tgreyuk/govuk-webcomponents

Repository files navigation

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:

  • Transpiling to ES5 will be required using build tools such as Webpack or Rollup.
  • The webcomponents.js pollyfills will need to be loaded.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published