Skip to main content

Get started

govuk-react is an implementation of the GOV.UK Design System in React. It’s built on govuk-frontend-react and styled by govuk-frontend’s CSS.

It has three layers:

  • govuk-react is the library most apps use. It re-exports govuk-frontend-react’s components, adds the behaviour govuk-frontend runs in JavaScript, and adds components govuk-frontend doesn’t have.
  • govuk-frontend-react is a direct port of govuk-frontend’s templates. Its HTML matches govuk-frontend’s, and it has no client-side behaviour.
  • @govuk-react/primitives holds the headless behaviour, such as tabs and the accordion, so that other libraries can use it too.

Components work before JavaScript loads. Where govuk-frontend adds behaviour in JavaScript, govuk-react renders the no-JavaScript version first, and a small inline script or custom element enhances it before React hydrates.

Next steps

  1. Install govuk-react.
  2. Serve the fonts and images govuk-frontend’s CSS needs.
  3. Browse the styles and components.
  4. Read the guides on composing parts, forms, styling and working without JavaScript.

If you’re upgrading from 0.x, read the migration guide.