Components
Components in the defra namespace. Everything else is an upstream
GOV.UK Frontend component restyled by tokens, unchanged in markup.
Each entry is generated from the component's own fixtures and from
deviations.json, so this page cannot describe a component that no
longer exists or miss one that does.
Add Another
Addition No GOV.UK Frontend equivalent.
Macro defraAddAnother
- Reference
- DEF-103
- Why not upstream
- No upstream component for repeating a group of fields. Needed for multiple abstraction points, land parcels and holdings.
- Prior art
- MoJ Design System - Add another
- JavaScript
- progressive enhancement only - submits to the server without it
- Approved by
- Not recorded
default
One item to start. Remove is hidden while only one remains — removing it would leave the form with nothing to complete. A visually hidden submit button sits first in the component: without it, pressing Enter in any field above the form's real button would activate item 1's Remove and silently delete it.
with several items
Adding or removing renumbers every legend, id, name, for and aria-describedby. A stale index breaks the hint and error association silently — invisible on screen, total for a screen reader.
Options
| Name | Type | Description |
|---|---|---|
items |
array required | The repeated groups. Each takes `html` containing the fields for one item. Index ids and names consistently, for example `points[0][grid]` and `points-0-grid`, so they can be renumbered. |
itemName |
string | Singular noun used in legends and button text, for example `abstraction point`. Defaults to `item`. |
classes |
string | Classes to add to the container. |
attributes |
object | HTML attributes to add to the container. |
_implicitSubmission |
note | Not an option. The component renders a visually hidden submit button before everything else, so that pressing Enter in a field submits the form normally instead of activating the first Remove button and deleting an item. Keep it first in the component, and do not place another submit button above the component in the form. |
Card
Addition No GOV.UK Frontend equivalent.
Macro defraCard
- Reference
- DEF-102
- Why not upstream
- GDS deliberately has no generic card; summary-list cards cover the check-answers case only. Kept intentionally narrow: heading, optional description, optional meta, an optional brand-green header band, and EITHER a whole-card link OR footer actions. No images, no nested cards. If a request needs a new option, that is a signal the layout wants a different component.
- Prior art
- GOV.UK publishing components, and card components in several departmental systems
- JavaScript
- none
- Approved by
- Not recorded
default
Heading and description only.
Water abstraction licence
Apply for a licence to take water from a river, stream, canal or underground source.
with whole card link
The whole card is clickable, but the link stays on the heading text — so the accessible name is the heading, not the whole block of copy. The pointer target is the card; the tab target is the heading.
For abstractions of more than 20 cubic metres a day.
with actions
Actions each carry visually hidden text, so "View" is distinguishable from every other "View" on the page when a screen reader lists the links.
AB/2026/0148 — River Kennet
Awaiting site inspection.
with green header
The Defra brand green (#00a33b) in the role the branding guidance sanctions for it — a header band, used sparingly. White on this green is 3.33:1, which conforms because the banded title is large text (19px bold, where the threshold is 3:1 rather than 4.5:1). The size and weight are pinned in CSS for that reason: shrink them and the contrast silently stops conforming.
Water abstraction licence
Apply for a licence to take water from a river, stream, canal or underground source.
with green header and whole card link
A linked heading on the band takes the same white rather than the link green, which would be close to invisible against the brand green. It stays underlined, so it still reads as a link. Focus keeps the upstream yellow block, which reads correctly on the band.
For abstractions of more than 20 cubic metres a day.
href ignored when actions are present
The heading still links, but the whole-card behaviour is dropped. Enforced in the template rather than left to documentation.
The card does not become clickable, because a whole-card overlay would cover the actions and make them unreachable.
Options
| Name | Type | Description |
|---|---|---|
title |
string required | The card heading. |
headingLevel |
integer | Heading level, 2 to 6. Defaults to 2. Set it so the card does not skip a level in the page's heading order. |
headerColour |
string | Renders the heading in a coloured band. `green` (the Defra brand green) is the only supported value — it is the role the branding guidance sanctions for that colour. The banded title is white and its size and weight are pinned, because white on this green (3.33:1) conforms only under the large-text threshold. |
href |
string | Makes the heading a link. If `actions` is not set, the whole card becomes clickable. |
meta |
string | Short supporting line above the description, such as a reference or a date. |
text |
string | Description. Ignored if `html` is set. |
html |
string | Description as HTML. |
actions |
array | Footer links. Setting this disables whole-card clicking, because an overlay would make these unreachable. |
classes |
string | Classes to add to the card. |
attributes |
object | HTML attributes to add to the card. |
Filter
Addition No GOV.UK Frontend equivalent.
Macro defraFilter
- Reference
- DEF-104
- Why not upstream
- No upstream component for filtering a list of results.
- Prior art
- MoJ Design System - Filter
- JavaScript
- progressive enhancement only - a plain form without it
- Approved by
- Not recorded
default
Selected filters are links that remove themselves, each carrying visually hidden "Remove filter" text — out of context, "Thames river basin" gives no clue that activating it removes something. The Show/Hide button appears below the tablet breakpoint only, and is created in JavaScript so it never exists as a control that cannot work.
Filter applications
with no filters selected
The selected filters block is omitted entirely rather than rendered empty.
Filter applications
Options
| Name | Type | Description |
|---|---|---|
groups |
array required | Groups of checkbox filters. |
selected |
array | Currently applied filters, rendered as links that remove them. Omit entirely when nothing is selected. |
heading |
string | Panel heading. Defaults to `Filter`. |
clearHref |
string | URL that clears every filter. Omitted if not set. |
id |
string | Prefix for the content id used by the disclosure button. |
classes |
string | Classes to add to the filter. |
attributes |
object | HTML attributes to add to the filter. |
Footer
Deviation Replaces an upstream component.
Macro defraFooter
- Reference
- DEF-001
- Reason
- GOV.UK footer asserts Royal Arms + OGL; not permitted outside the GOV.UK proposition
- Approved by
- TBC - Defra design authority
default
DEF-001. Replaces govukFooter outside the GOV.UK proposition: no Royal Arms, no OGL assertion. Renders a <div> exactly as v6's govukFooter does — the <footer> landmark belongs to the page template, and a component emitting its own produces a footer inside a footer.
no links
Omit `items` entirely rather than passing placeholder links. A prototype with three links to `#` tells a user less than a footer with none.
Options
| Name | Type | Description |
|---|---|---|
items |
array | Footer links, rendered as a list. Omit entirely rather than passing placeholder `#` links — a link that goes nowhere is worse than no link. |
visuallyHiddenTitle |
string | Accessible heading for the link list. Defaults to `Support links`. |
text |
string | Additional text below the links, for example a department name. |
html |
string | Additional content as HTML. Takes precedence over `text`. |
classes |
string | Classes to add to the footer. |
attributes |
object | HTML attributes to add to the footer. |
Grid Reference Input
Addition No GOV.UK Frontend equivalent.
Macro defraGridReferenceInput
- Reference
- DEF-111
- Why not upstream
- Net new. Ordnance Survey grid references appear across abstraction licensing, flood risk and land parcel services, and nothing cross-government covers them because no other department needs them. Built on govukInput rather than beside it — the pattern, hint and error live in one place instead of each team re-deriving the format.
- Prior art
- None. Format follows the Ordnance Survey national grid convention.
- JavaScript
- none
- Approved by
- Not recorded
default
Delegates to govukInput — no forked markup. The value is that the format, hint, width and input attributes are decided once rather than by every team that needs one.
with a value
`autocapitalize="characters"` because the two-letter prefix is always upper case and phone keyboards default to lower.
with an error
No `pattern` is applied by default: references vary in precision from SU 12 34 to SU 1234 5678, a pattern that rejects a valid one is worse than none, and the server must validate regardless.
Options
| Name | Type | Description |
|---|---|---|
id |
string | Input id. Defaults to `grid-reference`. |
name |
string | Form field name. Defaults to `gridReference`. |
value |
string | Current value. |
label |
object | Label options, as govukInput. Defaults to `Grid reference`. |
hint |
object | Hint options, as govukInput. Defaults to a worked example — replace it rather than removing it. |
errorMessage |
object | Error message options, as govukInput. Say what a valid reference looks like, not just that this one is wrong. |
classes |
string | Classes added alongside the default width. |
attributes |
object | HTML attributes to add to the input. |
Header
Configuration
Upstream govukGenericHeader, configured for Defra. Not a fork.
Macro govukGenericHeader
default
Not a fork. This is upstream `govukGenericHeader` with the Defra wordmark — GDS added generic-header for services outside the GOV.UK proposition, and Defra has no logo mark, so the header is a token-only restyle with zero forked markup. Do not build a Defra header component.
full name
Long-form wordmark for estates that require the full department name.
Options
| Name | Type | Description |
|---|---|---|
url |
string | The URL of the logo link. Defaults to the root of the current web domain ("/"). |
logoText |
string required | If `logoHtml` is set, this is not required. Text content for the logo section of the Generic header. |
logoHtml |
string required | If `logoText` is set, this is not required. HTML content for the logo section of the Generic header. |
containerClasses |
string | Classes for the container. Useful if you want to make the Generic header fixed width. |
classes |
string | Classes to add to the Generic header container. |
attributes |
object | HTML attributes (for example, data attributes) to add to the Generic header container. |
Identity Bar
Addition No GOV.UK Frontend equivalent.
Macro defraIdentityBar
- Reference
- DEF-110
- Why not upstream
- No upstream component for showing which record a caseworker is currently working on. Regulation and permitting work is long-running and interruptible, so the context has to persist across pages.
- Prior art
- MoJ Design System - Identity bar
- JavaScript
- none
- Approved by
- Not recorded
default
A complementary landmark with an accessible name, so it can be jumped to and skipped rather than re-read on every page of a case. The reference is not a heading — the page still needs its own h1, and two competing headings makes the structure worse.
without actions
Context alone, where the page offers no actions on the record.
Options
| Name | Type | Description |
|---|---|---|
title |
string required | The record reference. Carries the weight in the bar, but is deliberately not a heading. |
caption |
string | What kind of record it is, shown before the reference. |
meta |
string | Supporting detail such as the applicant or the status. |
actions |
array | Actions available on the record. |
container |
boolean | Wraps the contents in `govuk-width-container`, for a bar that spans the full page width. |
ariaLabel |
string | Accessible name for the landmark. Defaults to `Current record`. |
classes |
string | Classes to add to the bar. |
attributes |
object | HTML attributes to add to the bar. |
Search
Addition No GOV.UK Frontend equivalent.
Macro defraSearch
- Reference
- DEF-109
- Why not upstream
- GOV.UK Frontend has no search component. Completes the set with DEF-104 filter and DEF-105 sortable-table: without it, finding a case means filtering to it.
- Prior art
- GOV.UK publishing components - search, and MoJ Design System
- JavaScript
- none
- Approved by
- Not recorded
default
A real label, not a placeholder. Placeholder-as-label vanishes on typing, usually fails contrast, and is announced inconsistently — it is the most common accessibility failure in search boxes. Use `hideLabel` if it must not be seen.
with a visually hidden label
The label is still in the markup and still announced — only hidden visually.
Options
| Name | Type | Description |
|---|---|---|
label |
string | Label text. Defaults to `Search`. Always present in the markup — use `hideLabel` rather than removing it. |
hideLabel |
boolean | Hides the label visually while keeping it for screen readers. |
hint |
string | Hint text, for example what can be searched. |
id |
string | Input id. Defaults to `search`. Set it when a page has more than one. |
name |
string | Form field name. Defaults to `q`. |
value |
string | Current search term, so it persists on the results page. |
buttonText |
string | Button text. Defaults to `Search`. |
action |
string | Form action. |
method |
string | Form method. Defaults to `get`, so a search is linkable and shareable. |
classes |
string | Classes to add to the form. |
attributes |
object | HTML attributes to add to the form. |
Side Navigation
Addition No GOV.UK Frontend equivalent.
Macro defraSideNavigation
- Reference
- DEF-108
- Why not upstream
- No upstream component for navigating sections of a long page or areas of a case record.
- Prior art
- MoJ Design System - Side navigation, and the GOV.UK publishing components contents list
- JavaScript
- none
- Approved by
- Not recorded
default
A list of links with the current one marked by `aria-current`.
with nested sections
Nesting is in the markup, not just the indentation, so a screen reader announces the structure and the number of items at each level. One level of nesting only — a third would be a sign the page needs splitting.
Options
| Name | Type | Description |
|---|---|---|
items |
array required | The links. Each may contain its own `items` for one level of nesting. |
heading |
string | Heading above the list, for example the section or case reference. |
ariaLabel |
string | Accessible name for the navigation landmark. Defaults to `Side navigation`. |
classes |
string | Classes to add to the navigation. |
attributes |
object | HTML attributes to add to the navigation. |
Sortable Table
Addition No GOV.UK Frontend equivalent.
Macro defraSortableTable
- Reference
- DEF-105
- Why not upstream
- govukTable has no sortable header support.
- Prior art
- MoJ Design System - Sortable table
- JavaScript
- progressive enhancement only - headers are server-sort links without it
- Approved by
- Not recorded
default
Headers are links carrying the sort in the query string, so this works server-side with no JavaScript. The Received column sorts on `sortValue` (an ISO date), because sorting on the displayed text would order it alphabetically. Not every column has to be sortable.
| Reference | Applicant | Received | Status |
|---|---|---|---|
| AB/2026/0148 | Kennet Farms Ltd | 14 January 2026 | Awaiting inspection |
| AB/2026/0091 | Avon Water Co | 3 March 2026 | Approved |
| AB/2026/0233 | Blackwater Estates | 27 February 2026 | Withdrawn |
Options
| Name | Type | Description |
|---|---|---|
head |
array required | Header cells. |
rows |
array required | Array of rows, each an array of cells. |
sort |
string | `key` of the column currently sorted, so the server's sort state is reflected in `aria-sort`. |
order |
string | `ascending` or `descending`. Defaults to `ascending`. |
firstCellIsHeader |
boolean | Render the first cell of each row as a row header. |
caption |
string | Table caption. |
captionClasses |
string | Classes for the caption. Defaults to `govuk-table__caption--m`. |
classes |
string | Classes to add to the table. |
attributes |
object | HTML attributes to add to the table. |
Sub Navigation
Addition No GOV.UK Frontend equivalent.
Macro defraSubNavigation
- Reference
- DEF-107
- Why not upstream
- GOV.UK Frontend has service-navigation for primary navigation but nothing for secondary navigation within a section. govukTabs is NOT the alternative: it links to same-page anchors and shows and hides panels, so using it to move between pages breaks the URL, the back button and bookmarking, and announces panels rather than links. This component exists largely so teams stop reaching for tabs.
- Prior art
- MoJ Design System - Sub navigation
- JavaScript
- none
- Approved by
- Not recorded
default
Real links to real URLs, so the back button, bookmarking and open-in-new-tab all work. Use this rather than govukTabs for moving between pages: tabs link to same-page anchors and toggle panels, which breaks all three and announces panels instead of links.
with no current page
The space for the current-page marker is reserved on every item, so nothing shifts when one becomes current.
Options
| Name | Type | Description |
|---|---|---|
items |
array required | The links. |
ariaLabel |
string | Accessible name for the navigation landmark. Defaults to `Sub navigation`. Set it when a page has more than one, so they are distinguishable. |
classes |
string | Classes to add to the navigation. |
attributes |
object | HTML attributes to add to the navigation. |
Timeline
Addition No GOV.UK Frontend equivalent.
Macro defraTimeline
- Reference
- DEF-101
- Why not upstream
- GOV.UK Frontend has no component for chronological case history. Proposed to the GDS community backlog by others and not adopted.
- Prior art
- MoJ Design System - Timeline
- JavaScript
- none
- Approved by
- Not recorded
default
An ordered list, so a screen reader announces the number of entries and the position of each. Visual markers are drawn in CSS, so no decorative markup is exposed.
-
Completed: Application approved
Licence issued for 450 cubic metres per day, subject to low flow conditions.
-
Completed: Site inspection completed
Abstraction point confirmed at SU 1234 5678. No discrepancies found.
-
Completed: Application received
Submitted online with supporting hydrological assessment.
without bylines or descriptions
Every field except title and date is optional.
-
Completed: Permit surrendered
-
Completed: Permit varied
-
Completed: Permit granted
with steps still to do
A `todo` entry gets a hollow marker, a dashed rule and secondary text. None of that reaches a screen reader, so each entry is also announced as "Completed" or "Not yet done" before its title.
-
Not yet done: Decision issued
-
Not yet done: Consultation closes
Responses from the Environment Agency and the local authority are still outstanding.
-
Completed: Application published
Advertised in the local press and on the public register.
with html content
`headingLevel` sets the entry heading so the timeline fits the page's heading order — it must not skip a level.
-
Completed: Further information requested
We asked for:
- a revised abstraction volume
- evidence of landowner consent
Options
| Name | Type | Description |
|---|---|---|
items |
array required | The entries, newest first. Each takes `title`, `date`, and optionally `datetime`, `byline`, `text` or `html`. |
headingLevel |
integer | Heading level for each entry, 2 to 6. Defaults to 3. Set it so the timeline does not skip a level in the page's heading order. |
classes |
string | Classes to add to the timeline. |
attributes |
object | HTML attributes to add to the timeline. |
Timeout Dialog
Addition No GOV.UK Frontend equivalent.
Macro defraTimeoutDialog
- Reference
- DEF-106
- Why not upstream
- No upstream component, but WCAG 2.2 success criterion 2.2.1 Timing Adjustable requires warning and extension on a session limit. This is a conformance obligation on any Defra service with a session timeout, not a convenience.
- Prior art
- HMRC Frontend - Timeout dialog
- JavaScript
- required - the component does nothing without it, which is why the server must never rely on it alone
- Approved by
- Not recorded
default
A 15 minute session warned at 2 minutes. The dialog is closed until the warning fires — see the demo story to open it immediately.
demo, warns after two seconds
Warns almost immediately so the countdown, focus placement and Escape-to-extend can be exercised. The visible countdown ticks every second; the screen reader announcement fires only at 120, 60, 30, 20, 10 and 5 seconds, because a live region updating every second is unusable.
Options
| Name | Type | Description |
|---|---|---|
timeout |
integer | Session length in seconds. Defaults to 900. Must match the server's real session length — a dialog that disagrees with the server is worse than none. |
warning |
integer | Seconds before expiry to warn. Defaults to 120. WCAG 2.2.1 requires at least 20 seconds. |
signOutUrl |
string required | Where to send the user on expiry, and the destination of the Sign out link. |
keepAliveUrl |
string | Endpoint fetched to extend the session. If the fetch fails the warning reappears rather than silently pretending to have succeeded. |
title |
string | Dialog heading. Defaults to `You are about to be signed out`. |
text |
string | Extra paragraph, for example what happens to unsaved answers. |
keepAliveText |
string | Primary button text. Defaults to `Stay signed in`. |
signOutText |
string | Sign out link text. Defaults to `Sign out`. |
classes |
string | Classes to add to the dialog. |
attributes |
object | HTML attributes to add to the dialog. |