Next.js developer in Newcastle

Using GOV.UK Frontend and the GOV.UK Design System inside a Next.js app: install requirements, Sass and JavaScript setup, fonts and branding rules, and the Service Standard points it supports.

Next.js developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.

My WordPress.org profile

The GOV.UK Design System is the shared set of styles, components and patterns that public services in the UK are built from. A Newcastle team that builds a form-heavy front end for a council, a health body or a supplier to one will meet it early. Next.js can carry it, with a few decisions about Sass, JavaScript and branding. This page follows the official documentation and says where it stops. I build the front end, and your service team owns the Service Standard assessment.

Newcastle Quayside under the Tyne bridges

Bridges across the Tyne at Newcastle Quayside. Photo: Wilka Hudson, CC BY 2.0, via Wikimedia Commons.

#What is the GOV.UK Design System?

The home page of the Design System calls it guidance and reusable resources for building government services, so that services are consistent with GOV.UK. It has three parts:

  • Styles: layout, typography, colour and images that make a service look like GOV.UK.
  • Components: reusable, accessible components for forms, navigation, panels, tables and more.
  • Patterns: guidance for common tasks, such as entering names and addresses, completing forms and creating accounts.

The Government Digital Service maintains it with a community around it. The page says it is “for everyone that works on government services” and does not say whether people outside government may use it. The code is distributed as GOV.UK Frontend.

#What does GOV.UK Frontend need from my build?

The npm install guide lists these requirements:

RequirementWhat the guide says
Node.js12.17.0 or later, so that ES modules work; the latest LTS is recommended
SassDart Sass 1.79.0 or higher; LibSass and Ruby Sass are not supported
Nunjucks3.0.0 or later, optional, for the macros
Installnpm install govuk-frontend --save

The guide shows the Sass entry as @use "node_modules/govuk-frontend/dist/govuk" as *;. For JavaScript it shows a module script that imports initAll and calls it. The guide recommends a build pipeline over copying files by hand, and says that in live applications you import only the components you use and initialise them with createAll.

The same guide describes HTML, Nunjucks macros and plain JavaScript. It does not describe a React or Next.js integration. In a Next.js app you therefore take the documented component HTML, which each component page on the Design System shows with its classes, and write it as JSX. Where a component page gives you markup, that markup is the contract.

#How do I load the Sass in Next.js?

The Next.js Sass guide says Next.js supports .scss and .sass once the sass package is installed, and that options go in sassOptions in next.config. The two guides meet at one point: the version. GOV.UK Frontend wants Dart Sass 1.79.0 or higher, so look at which sass version npm ls sass resolves in your project before you import the stylesheet.

// app/govuk.scss
@use "govuk-frontend/dist/govuk" as *;
// app/layout.tsx
import './govuk.scss'

Whether the load path in the first line resolves depends on your Sass setup. The path in the install guide begins with node_modules, so keep that form if the shorter one fails, and test the first build before anything else is built on it.

#How do I initialise the JavaScript in Next.js?

GOV.UK Frontend components such as accordions, character counts and the skip link add behaviour through JavaScript. The import guide says bundled files must be loaded as module scripts, that you should import only the components you need, and shows this:

import { SkipLink, CharacterCount, createAll } from 'govuk-frontend'

createAll(SkipLink)
createAll(CharacterCount, { maxLength: 500 })

It also warns that you must import every component your application uses, or some components will not work for users of assistive technologies. The scope argument lets you initialise only part of a page.

The Next.js docs say layouts and pages are Server Components by default, and that code needing browser APIs or lifecycle logic goes into a Client Component marked with 'use client'. A natural fit is one small Client Component that calls createAll for the components the page renders, inside useEffect:

'use client'
import { useEffect } from 'react'
import { CharacterCount, createAll } from 'govuk-frontend'

export function GovukScripts() {
  useEffect(() => {
    createAll(CharacterCount)
  }, [])
  return null
}

This pattern is a design choice of mine, not one the GOV.UK documentation describes, because that documentation does not cover React. React re-renders can replace markup that GOV.UK scripts have changed, so keep the elements that the scripts enhance stable, and test with a keyboard and a screen reader rather than trusting that it works.

#What about progressive enhancement?

The import guide says the type="module" requirement protects older browsers, and that the inline snippet adds the govuk-frontend-supported class in supported browsers, so styles and behaviour can target them. Server rendering helps here. A Server Component sends complete HTML, and the form works as a form before any script runs. The Next.js docs also say that by default Server Components reduce the JavaScript sent to the browser. For a form-based public service that is the right direction: HTML first, scripts as a layer.

#Do I have to use the GDS Transport font and the crown?

The typeface page says that if the service is on the service.gov.uk subdomain, you must use the GDS Transport font. If it is publicly available on a different subdomain, you use an alternative typeface. The page gives no rules on the crown or the logo and points to the Service Manual section on making a service look like GOV.UK for services that are not on GOV.UK. I could not load that Service Manual page, so I do not summarise it.

For a service that is not part of GOV.UK, the frontend guide on using GOV.UK Frontend without branding applies from version 6.3.0. Its four steps:

  1. Use the Generic header component.
  2. Redefine $govuk-font-family and $govuk-functional-colours in one @use ... with statement.
  3. Replace the favicons, mobile icons and sharing image, keeping the filenames.
  4. Change the template theme-color value.

Which side of that line your service falls on is a question for your service owner and the Design System team, not for the build.

#Which Service Standard points does the Design System support?

The Service Standard has 14 points. The ones that touch a front end build most:

PointWhat the Service Manual says
4, make the service simple to useA consistent experience from start to finish, consistent with the design of GOV.UK and following the GOV.UK style guide for text
5, make sure everyone can use the serviceMeet accessibility standards online and offline, research with people who have access needs, provide assisted digital support
9, create a secure service which protects users’ privacyTitle only in my reading
11, choose the right tools and technologyTitle only in my reading
12, make new source code openTitle only in my reading
13, use and contribute to open standards, common components and patternsTitle only in my reading

The point 5 page I read names no WCAG version and no testing method, and it links to separate accessibility guidance that I did not read. Components that the Design System documents as accessible are a start, but they do not replace testing your own pages and journeys. Components from the Design System cover points 4 and 13 well. They do not cover point 5 for your content, your error messages or your custom pages.

#Where does Next.js fit best in a public service build?

Three places, each from the Next.js docs.

  • Server rendering: pages and layouts are Server Components by default, and they fetch data on the server and send HTML.
  • Small client surface: the docs advise adding 'use client' to the files that define interactive components instead of marking large parts of the UI as Client Components.
  • Server-side secrets: environment variables without the NEXT_PUBLIC_ prefix stay on the server, so API keys for back-end systems do not reach the browser.

None of this is specific to government. It is the same Next.js behaviour, used in a way that suits a transactional front end.

#Checklist for a GOV.UK Design System build in Next.js

  • Confirm with the service owner whether the service uses GOV.UK branding or the version without it.
  • Check the Node.js and Dart Sass versions against the install guide.
  • Install govuk-frontend and load the Sass in the root layout.
  • Write component markup as JSX, copied from the component pages.
  • Import and initialise only the components you use, and all of them.
  • Keep the scripts in a small Client Component.
  • Test keyboard, screen reader and no-JavaScript paths on each journey.
  • Use the right font for the domain you deploy on.

#How does a project run?

  1. You send the service description, the journeys, the hosting and whether it carries GOV.UK branding. I reply to email within 24 hours, Monday to Friday.
  2. I write down the scope and my assumptions, with questions on components, scripts and testing.
  3. I build on a staging copy, and your team reviews each journey.
  4. After your written approval of the staging copy, I publish.

I work remotely, and everything stays in email and shared documents. The overview of the work is on the Next.js developer page.

Need this service: Next.js developer in Newcastle?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Explore other WordPress services and knowledge base