Skip to content

Commit 8a34c64

Browse files
authored
Merge pull request #5394 from alphagov/generic-header
Add generic header component page
2 parents 344051f + a382efb commit 8a34c64

6 files changed

Lines changed: 119 additions & 4 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Generic header
3+
layout: layout-example.njk
4+
includeFrontend: false
5+
stylesheets:
6+
- ../../../stylesheets/example-without-transport-font.css
7+
---
8+
9+
{% from "govuk/components/generic-header/macro.njk" import govukGenericHeader %}
10+
11+
{% set logoContent %}
12+
<svg width="28" height="30" viewBox="0 0 28 30" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
13+
<circle cx="13.5549" cy="4.21349" r="4.21349"/>
14+
<circle cx="13.5549" cy="25.7865" r="4.21349"/>
15+
<circle cx="22.8963" cy="9.6068" r="4.21349"/>
16+
<circle cx="4.2135" cy="20.3932" r="4.21349"/>
17+
<circle cx="22.8963" cy="20.3932" r="4.21349"/>
18+
<circle cx="4.21351" cy="9.60674" r="4.21349"/>
19+
</svg> Service name
20+
{% endset %}
21+
22+
{{ govukGenericHeader({
23+
url: "#",
24+
logoHtml: logoContent
25+
}) }}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Generic header
3+
description: A generic header to help services not on GOV.UK
4+
section: Components
5+
aliases: Header (generic)
6+
backlogIssueId: 185
7+
layout: layout-pane.njk
8+
---
9+
10+
{% from "_example.njk" import example %}
11+
12+
Use this generic version of the header to tell users they’re using a government service that’s not part of the GOV.UK website.
13+
14+
{{ example({ group: "components", item: "generic-header", example: "default", id: "default-1", html: true, nunjucks: true, open: false, loading: "eager" }) }}
15+
16+
## When to use this component
17+
18+
Use the Generic header component if your service is both:
19+
20+
- a public-facing government service
21+
- not on the GOV.UK website (meaning that your service is not part of the [GOV.UK proposition](https://www.gov.uk/government/publications/govuk-proposition/govuk-proposition))
22+
23+
This is to bring consistency and maintain user trust in journeys that move between the GOV.UK website and other government websites and services.
24+
25+
This component also helps ensure your non-GOV.UK service does not:
26+
27+
- identify itself as being part of GOV.UK
28+
- use the crown or GOV.UK logotype in the header
29+
- use the GDS Transport typeface
30+
- use the [GOV.UK brand colours](https://brand.design-system.service.gov.uk/colour/govuk-blue/)
31+
32+
See the guidance on [if your service is not on GOV.UK in the Service manual](https://www.gov.uk/service-manual/design/making-your-service-look-like-govuk).
33+
34+
## When not to use this component
35+
36+
If your service is hosted on one of these gov.uk domains, you must use the [GOV.UK header component](/components/header/) instead:
37+
38+
- gov.uk/[myservice]
39+
- [myservice].service.gov.uk
40+
- [myblog].blog.gov.uk
41+
42+
## How it works
43+
44+
If you use the [page template](/styles/page-template/), you’ll first need to replace the default GOV.UK header in the page template with the Generic header component.
45+
46+
Use the Generic header component to display your own:
47+
48+
- brand logo
49+
- homepage link
50+
- font for your service name (instead of GDS Transport)
51+
52+
You must also follow the steps in the [Using GOV.UK Frontend without GOV.UK branding guidance](https://frontend.design-system.service.gov.uk/using-govuk-frontend-without-govuk-branding/) to remove other GOV.UK brand elements elsewhere in your service.
53+
54+
### Using your own brand logo
55+
56+
Follow your organisation’s guidelines and best practice to show your brand logo.
57+
58+
To make your logo image as accessible and optimised as possible, also see:
59+
60+
- Design System guidance on [using images](/styles/images/)
61+
- [Image guidance for GOV.UK content and publishers](https://guidance.publishing.service.gov.uk/formatting-content/images/)
62+
63+
### Homepage link
64+
65+
By default, the Generic header component links to `/`, which is the top level of your service’s domain. You should customise the link to point to wherever makes the most sense for your service.
66+
67+
### Do not show service name or navigation links in the Generic header component
68+
69+
As with the GOV.UK header component, you should not use the Generic header component to show service name or navigation links. Use the [Service navigation component](/components/service-navigation) instead.
70+
71+
## Research on this component
72+
73+
When developing this component, we worked with a cross-government working group representing various government departments that work on services not hosted on GOV.UK.
74+
75+
We thank them for their work to gather the needs and considerations for consistent headers across all government services.

src/components/header/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ If your service is being hosted on one of these domains, use the GOV.UK header c
2323
- [myservice].service.gov.uk
2424
- [myblog].blog.gov.uk
2525

26-
You must use the GOV.UK header component at the top of every page. The Service Manual explains why it’s important for you to [make your service look like GOV.UK](https://www.gov.uk/service-manual/design/making-your-service-look-like-govuk).
26+
You must use the GOV.UK header component at the top of every page. This is to maintain user trust as they move around the GOV.UK website and other government websites and services.
27+
28+
The Service Manual explains why it’s important for you to [make your service look like GOV.UK](https://www.gov.uk/service-manual/design/making-your-service-look-like-govuk).
2729

2830
## When not to use this component
2931

3032
If your service is not hosted on one of the gov.uk domains outlined, you must not use the GOV.UK header component as it’s not considered part of GOV.UK.
3133

32-
You can still build from this component, but you’ll need to [make some changes to make sure users do not confuse your website with GOV.UK](https://www.gov.uk/service-manual/design/making-your-service-look-like-govuk#if-your-service-isnt-on-govuk).
34+
Use the [Generic header component](/components/generic-header/) instead to show your own organisation’s branding.
3335

3436
## How it works
3537

src/styles/typeface/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If your service is on the service.gov.uk subdomain you must use the GDS Transpor
1212

1313
## When not to use the GDS Transport font
1414

15-
If your service is publicly available on a subdomain other than service.gov.uk, use an alternative typeface like Helvetica or Arial.
15+
If your service is publicly available on a subdomain other than service.gov.uk, use an alternative typeface. Read our guidance on [Using GOV.UK Frontend without GOV.UK branding](https://frontend.design-system.service.gov.uk/using-govuk-frontend-without-govuk-branding/) for how to change your service’s font to a similar typeface.
1616

1717
If you’re not sure whether you should use GDS Transport, do one of the following:
1818

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Imports frontend without the Transport font
2+
// Used by Generic header component examples
3+
4+
@use "pkg:govuk-frontend" with (
5+
$govuk-font-family: (
6+
"Helvetica Neue",
7+
helvetica,
8+
arial,
9+
sans-serif
10+
)
11+
);

views/layouts/layout-example.njk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
<meta name="og:description" content="{{ description | smartypants }}">
1313
<link rel="canonical" href="{{ canonical }}">
1414

15-
<link href="{{ getFingerprint('/stylesheets/govuk-frontend.min.css') }}" rel="stylesheet" media="all">
15+
{% if includeFrontend != false %}
16+
<link href="{{ getFingerprint('/stylesheets/govuk-frontend.min.css') }}" rel="stylesheet" media="all">
17+
{% endif %}
1618
<link href="{{ getFingerprint('/stylesheets/example.css') }}" rel="stylesheet" media="all">
1719
{#- Include any additional stylesheets specified in the example frontmatter #}
1820
{% for stylesheet in stylesheets %}

0 commit comments

Comments
 (0)