Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2feba57
remove unnecessary readmes
MatMoore Aug 11, 2025
ecf9745
Start upgrade to v10
MatMoore Jul 14, 2025
8f09c6b
Add compatability tests
MatMoore Jul 14, 2025
85b899b
whitespace fixes
MatMoore Jul 14, 2025
ec5435c
[date-input] fix aria-describedby
MatMoore Jul 14, 2025
8b2e550
[inset-text] remove legacy param to match upstream
MatMoore Jul 14, 2025
51d1efb
[radios] fix aria describedby
MatMoore Jul 14, 2025
b46a03e
[radios] remove "-1" prefix for the id of the first radio
MatMoore Jul 14, 2025
81f3a43
[details] rename text -> summaryText
MatMoore Jul 14, 2025
f5759aa
[checkboxes] id fix
MatMoore Jul 14, 2025
a7ca657
[checkboxes] fix describedBy
MatMoore Jul 14, 2025
7f49fdc
[button] update to latest template
MatMoore Jul 14, 2025
48f3401
[footer] update to latest template
MatMoore Aug 11, 2025
91accd1
[skip-link] add missing data-module
MatMoore Aug 11, 2025
969babd
[error-summary] add missing data-module
MatMoore Aug 11, 2025
1856fb3
[input] fix `none` test
MatMoore Aug 11, 2025
628345a
[input] support params.describedBy and make id optional
MatMoore Aug 11, 2025
539b1db
[input] support form group attributes
MatMoore Aug 11, 2025
e53abdf
[notification-banner] add new component
MatMoore Aug 11, 2025
eb87fcd
[radios] add data-module
MatMoore Aug 11, 2025
98b8e98
[character-count] make id optional
MatMoore Aug 11, 2025
fef16ef
[character-count] don't pass error class to textarea
MatMoore Aug 11, 2025
f43f59e
[textarea] add describedBy param and make id optional
MatMoore Aug 11, 2025
d4bd2f8
[details] update caller support
MatMoore Aug 11, 2025
ed0141e
[header] wip new header
MatMoore Aug 12, 2025
abb3e24
[checkboxes] add data-module
MatMoore Aug 12, 2025
7afcb72
[select] support describedBy and make id optional
MatMoore Aug 12, 2025
438c9ea
[select] support params.disabled
MatMoore Aug 12, 2025
15c8de5
[select] allow selecting by text content; empty items
MatMoore Aug 12, 2025
813cfe2
[header] workaround for `items` clashing with `dict.items`
MatMoore Aug 12, 2025
84a8635
[header] update to latest template
MatMoore Aug 21, 2025
c27e4e1
[header] allow passing empty mapping for params.search
MatMoore Aug 21, 2025
fa4fc70
update to latest release candidate of nhsuk-frontend
MatMoore Aug 21, 2025
e635d21
add nhsIcon macro
MatMoore Aug 21, 2025
29f4f13
[pagination] use new nhsIcon macro
MatMoore Aug 21, 2025
f2e2edb
[error-summary] support disableAutoFocus
MatMoore Aug 21, 2025
5e01124
[card] use nhsukIcon macro
MatMoore Aug 21, 2025
1628923
[action-link] use nhsukIcon macro
MatMoore Aug 21, 2025
628e639
[do-dont-list] use nhsukIcon macro
MatMoore Aug 21, 2025
af9d7aa
[back-link] use new simplified markup
MatMoore Aug 21, 2025
0357612
[breadcrumb] use new markup and backLink macro
MatMoore Aug 21, 2025
5bf3115
[header] use nhsukIcon macro and remove chevron down icon
MatMoore Aug 21, 2025
804661e
[card] remove deprecated HTML param
MatMoore Aug 21, 2025
cbbe629
tidy up changelog
MatMoore Aug 21, 2025
ec3a28f
[back-link] fix lint error
MatMoore Aug 21, 2025
69e4b05
update documentation for merging new changes
MatMoore Aug 21, 2025
5d86447
remove documentation site & backstop tests
MatMoore Aug 21, 2025
3cf6be7
update to final release of v10.0.0
MatMoore Sep 1, 2025
efadf18
[icon] update icon width/height to match font size
MatMoore Sep 1, 2025
ce0feb5
[action-link] remove wrapper element
MatMoore Sep 1, 2025
89674f2
ensure all components support params.id
MatMoore Sep 1, 2025
cd717e3
update CI to use new unit test suite
MatMoore Sep 1, 2025
f22c300
fixup button aria-disabled
MatMoore Sep 1, 2025
1cff0ce
rename templates path to nhsuk, and use full paths in imports
MatMoore Sep 1, 2025
b36c0a9
fix persistent typos
MatMoore Sep 1, 2025
bfcbd35
[warning-callout] remove legacy params.HTML
MatMoore Sep 1, 2025
b4d3183
support params.formGroup.attributes
MatMoore Sep 1, 2025
76ab336
fix incorrect class name in breadcrumb li
MatMoore Sep 1, 2025
624de97
[select] support params.formGroup.classes
MatMoore Sep 1, 2025
40d3727
[tables] check cell.header before applying .nhsuk-table-responsive_he…
MatMoore Sep 1, 2025
37e0537
[hero] support params.containerClasses
MatMoore Sep 1, 2025
9d116ad
[template] update meta tags, icons, js detection
MatMoore Sep 1, 2025
f6019a3
[attributes] sync macro with govuk_frontend_jinja
MatMoore Sep 1, 2025
8916450
add missing check of params.fieldset.describedBy
MatMoore Sep 1, 2025
5573ced
[input] lowercase params.spellcheck
MatMoore Sep 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 2 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,8 @@ jobs:
- name: Install Node dependencies
run: npm ci

- name: Setup Playwright
run: npm run install:playwright

- name: Run linting
run: npm run lint

# Remove once we can test for HTML equivalence with nhsuk-frontend
- name: Run visual tests
run: npm run test:visual --ignore-scripts

- name: Save backstop report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: Backstop report
path: tests/backstop/
if-no-files-found: ignore
- name: Run unit tests
run: poetry run pytest
174 changes: 174 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,180 @@

## Unreleased

## 0.4.0 - 21 August 2025

- Supports [nhsuk-frontend v1.0.0](https://github.com/nhsuk/nhsuk-frontend/compare/v9.6.4...v10.0.0).
- This includes redesigns of the header and footer components.
- See the [nhsuk-frontend changelog](https://github.com/nhsuk/nhsuk-frontend/blob/main/CHANGELOG.md) for further details.
- Renamed the template path (see breaking changes below)

### Breaking changes

#### Jinja2 environment configuration

The top level template path has changed from `templates` to `nhsuk`, to more closely match `nhsuk-frontend`, and to avoid confusion
if multiple design systems are used in the same application.

In your app configuration, change any `PackageLoader` that pass a `package_path`:

Before:

```python
PackageLoader("nhsuk_frontend_jinja", package_path="templates/components"),
PackageLoader("nhsuk_frontend_jinja", package_path="templates/macros"),
```

After:

```python
PackageLoader("nhsuk_frontend_jinja", package_path="nhsuk/components"),
PackageLoader("nhsuk_frontend_jinja", package_path="nhsuk/macros"),
```

Any imports starting with `templates/` should be changed to `nhsuk/` as well.

#### Details component

Rename details component `text` param to `summaryText`:

```
{{ details({
- "text": "Where can I find my NHS number?",
+ "summaryText": "Where can I find my NHS number?",
"html": "<p>An NHS number is a 10 digit number, like 485 777 3456.</p>"
}) }}
```

#### Header component

If you're using the `header` macro in your service, you must:

- Rename the `transactionalService` option to the new `service` option, and remove the boolean `transactional` option.
- Replace the `primaryLinks` option with the nested `navigation.items` option, using `text` and `href` instead of `label` and `url`.
- Replace the `searchAction` option with the nested `search.action` option.
- Replace the `searchInputName` option with the nested `search.name` option.
- Remove the boolean `showNav` and `showSearch` options. The respective parts of the header are now shown automatically when `navigation.items` or `search` options are provided.
- Check the `classes` option for `nhsuk-header--white-nav` and remove it. To turn the navigation white, add the modifier class `nhsuk-header__navigation--white` to the nested `navigation.classes` option.
- Remove the `nhsuk-header__navigation-list--left-aligned` modifier class, navigation items are now aligned left by default.

To restore the previous justified alignment, where navigation items appeared evenly spaced out, add the new `nhsuk-header__navigation--justified` modifier class to the nested `navigation.classes` option.

#### Footer component

If you're using the `footer` macro in your service, you must:

- Replace the `links` option with the nested `navigation.items` option.
- Replace the `metaLinks` option with the nested `meta.items` option.
- Update all items to rename `label` to `text` and `URL` to `href`.

Before:

```jinja
{% block footer %}
{{ footer({
links: [
{
label: "NHS sites",
URL: "https://www.nhs.uk/nhs-sites"
},
{
label: "About us",
URL: "https://www.nhs.uk/about-us"
},
{
label: "Give us feedback",
URL: "https://www.nhs.uk/give-feedback-about-the-nhs-website/"
}
],
metaLinks: [
{
label: "Accessibility",
URL: "https://www.nhs.uk/accessibility/"
},
{
label: "Our policies",
URL: "https://www.nhs.uk/our-policies/"
}
]
}) }}
{% endblock %}
```

After:

```jinja
{% block footer %}
{{ footer({
navigation: {
items: [
{
text: "NHS sites",
href: "https://www.nhs.uk/nhs-sites"
},
{
text: "About us",
href: "https://www.nhs.uk/about-us"
},
{
text: "Give us feedback",
href: "https://www.nhs.uk/give-feedback-about-the-nhs-website/"
}
]
},
meta: {
items: [
{
href: "https://www.nhs.uk/accessibility/",
text: "Accessibility"
},
{
href: "https://www.nhs.uk/our-policies/",
text: "Our policies"
}
]
}
}) }}
{% endblock %}
```

#### Error summary component

If you've linked from an [error summary](https://design-system.service.gov.uk/components/error-summary/) component to the first input in a [radios](https://design-system.service.gov.uk/components/radios/) or [checkboxes](https://design-system.service.gov.uk/components/checkboxes/) component, the link may no longer work.

This is because the `id` of the first checkbox or radio item no longer has the suffix `-1`.

If you're using the `errorSummary` macro, remove `-1` from the end of the `href` attribute:

```patch
{{ errorSummary({
titleText: "There is a problem",
errorList: [
{
"text": "Select how you like to be contacted",
- "href": "#contact-preference-1"
+ "href": "#contact-preference"
}
]
}) }}
```

#### Rename component `HTML` param to `html`

If you're using the `card`, `details`, `insetText` or `warningCallout` macros, you need to rename the `HTML` param to `html`:

```patch
{{ insetText({
- "HTML": "<p>You'll need to stay away from school, nursery or work until all the spots have crusted over. This is usually 5 days after the spots first appeared.</p>"
+ "html": "<p>You'll need to stay away from school, nursery or work until all the spots have crusted over. This is usually 5 days after the spots first appeared.</p>"
}) }}
```

### Fixes and improvements

- nhsuk-frontend-jinja now tests all examples from `nhsuk-frontend` to make sure the rendered HTML is the same.

- `aria-describedby` is no longer missing from the rendered HTML.

## 0.3.1 - 5 June 2025

- Update to [nhsuk-frontend v9.6.2](https://github.com/nhsuk/nhsuk-frontend/blob/main/CHANGELOG.md#962---9-june-2025).
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The following table shows the version of NHS.UK frontend jinja that you should u
| 9.5.2 | 0.2.0 |
| 9.6.1 | 0.3.0 |
| 9.6.2 | 0.3.1 |
| 10.0.0 | 0.4.0 |

### Configuration

Expand All @@ -37,8 +38,6 @@ app.jinja_options = {
"loader": ChoiceLoader(
[
FileSystemLoader(PATH_TO_YOUR_TEMPLATES),
PackageLoader("nhsuk_frontend_jinja", package_path="templates/components"),
PackageLoader("nhsuk_frontend_jinja", package_path="templates/macros"),
PackageLoader("nhsuk_frontend_jinja"),
]
),
Expand All @@ -54,13 +53,24 @@ jinja_env = Environment(
undefined=ChainableUndefined,
loader=ChoiceLoader([
FileSystemLoader(PATH_TO_YOUR_TEMPLATES),
PackageLoader("nhsuk_frontend_jinja", package_path="templates/components"),
PackageLoader("nhsuk_frontend_jinja", package_path="templates/macros"),
PackageLoader("nhsuk_frontend_jinja"),
]),
**options)
```

Alternatively, if you want to reference components without the 'nhsuk/components' or 'nhsuk/macros' prefixes, you can include additional `PackageLoaders` that specify `package_path`:

```python
ChoiceLoader([
FileSystemLoader(PATH_TO_YOUR_TEMPLATES),

PackageLoader("nhsuk_frontend_jinja", package_path="nhsuk/components"),
PackageLoader("nhsuk_frontend_jinja", package_path="nhsuk/macros"),

PackageLoader("nhsuk_frontend_jinja"),
])
```

You should then be able to extend the [default page template](https://service-manual.nhs.uk/design-system/styles/page-template):

```jinja
Expand All @@ -81,7 +91,7 @@ Visit the [NHS digital service manual](https://service-manual.nhs.uk/design-syst
All our macros take identical arguments to the Nunjucks ones, except you need to quote the parameter names.

```jinja
{% from 'warning-callout/macro.jinja' import warningCallout %}
{% from 'nhsuk/warning-callout/macro.jinja' import warningCallout %}

{{ warningCallout({
"heading": "Quotey McQuoteface",
Expand Down
44 changes: 0 additions & 44 deletions app/main.py

This file was deleted.

4 changes: 0 additions & 4 deletions app/templates/_templates/example.jinja

This file was deleted.

17 changes: 0 additions & 17 deletions app/templates/_templates/layout.jinja

This file was deleted.

37 changes: 0 additions & 37 deletions app/templates/_templates/page.jinja

This file was deleted.

16 changes: 0 additions & 16 deletions app/templates/components/action-link/index.jinja

This file was deleted.

Loading
Loading