Skip to main content
GOV.UK
Frontend
Menu
v5.x (Latest)
v4.x
Table of contents
Search (via Google)
Search
GOV.UK Frontend
Install with Node.js package manager (npm)
Requirements
Install GOV.UK Frontend
Get the CSS, Assets and JavaScript working
Try GOV.UK Frontend using precompiled files
What you cannot do with the precompiled files
Copy and install the precompiled files
Create an example page to check for errors
Use Nunjucks
Before you start
Set up Nunjucks and use the page template
Adding a component
Configuring a component
Import CSS
Add the CSS file to your HTML
Import using Sass
Import specific parts using Sass
Import an individual component’s CSS using a single Sass import
Simplify Sass import paths
Override with your own CSS
Silence deprecation warnings from dependencies in Dart Sass
Import font and images assets
Serve the assets from the GOV.UK Frontend assets folder - recommended
Copy the font and image files into your application
Import JavaScript
Before you start
Add the JavaScript file to your HTML
Import JavaScript using a bundler
Initialise only part of a page
Import JavaScript using alternative module formats
If our inline JavaScript snippet is blocked by a Content Security Policy
Configure components
Setting Nunjucks macro options
Passing JavaScript configuration
Adding HTML data attributes
Staying up to date with changes
Getting updates when we publish a new release
Find out which version you’re currently using
Understanding what has changed
Updating to the latest version
Localise GOV.UK Frontend
Changing the text you pass to a component
Changing the text in the HTML for a component
Changing text in the JavaScript for a component
Test if your HTML matches GOV.UK Frontend
Using the HTML test files
Browser support
Grade A
Grade B
Grade C
Grade X
Building your own JavaScript components
Using the Component class
Using createAll with your components
Building configurable components
Checking for GOV.UK Frontend support with isSupported()
JavaScript API Reference
Accordion
Button
CharacterCount
ErrorSummary
ExitThisPage
NotificationBanner
Sass API reference
Settings
Tools
Helpers
Components
Objects
Changes to GOV.UK Frontend v5.0.0
Migrating from v4 to v5
Benefits of updating to v5
Main changes to v5
Accessibility changes to v5
What upcoming changes to GOV.UK Frontend mean for your digital teams
This page has been archived. See
Changes to GOV.UK Frontend v5.0.0
for more information.