-
Notifications
You must be signed in to change notification settings - Fork 325
/
header.yaml
295 lines (277 loc) · 8.63 KB
/
header.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
params:
- name: homepageUrl
type: string
required: false
description: The URL of the homepage. Defaults to `/`
- name: assetsPath
type: string
required: false
description: The public path for the assets folder. If not provided it defaults to /assets/images
- name: productName
type: string
required: false
description: Product name, used when the product name follows on directly from ‘GOV.UK’. For example, GOV.UK Pay or GOV.UK Design System. In most circumstances, you should use `serviceName`.
- name: serviceName
type: string
required: false
description: The name of your service, included in the header.
- name: serviceUrl
type: string
required: false
description: URL for the service name anchor.
- name: navigation
type: array
required: false
description: An array of navigation item objects.
params:
- name: text
type: string
required: true
description: Text for the navigation item. If `html` is provided, the `text` option will be ignored.
- name: html
type: string
required: true
description: HTML for the navigation item. If `html` is provided, the `text` option will be ignored.
- name: href
type: string
required: false
description: URL of the navigation item anchor.
- name: active
type: boolean
required: false
description: Flag to mark the navigation item as active or not.
- name: attributes
type: object
required: false
description: HTML attributes (for example data attributes) to add to the navigation item anchor.
- name: navigationClasses
type: string
required: false
description: Classes for the navigation section of the header.
- name: navigationLabel
type: string
required: false
description: Text for the `aria-label` attribute of the navigation. Defaults to 'Menu'.
- name: menuButtonLabel
type: string
required: false
description: Text for the `aria-label` attribute of the button that toggles the navigation. Defaults to 'Show or hide menu'.
- name: containerClasses
type: string
required: false
description: Classes for the container, useful if you want to make the header fixed width.
- name: classes
type: string
required: false
description: Classes to add to the header container.
- name: attributes
type: object
required: false
description: HTML attributes (for example data attributes) to add to the header container.
previewLayout: full-width
accessibilityCriteria: |
Text and links in the Header must:
- have a text contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
Links in the Header must:
- accept focus
- be focusable with a keyboard
- be usable with a keyboard
- indicate when they have focus
- change in appearance when touched (in the touch-down state)
- change in appearance when hovered
- have visible text
Images in the Header must:
- be presentational when linked to from accompanying text (crown icon).
Landmarks and Roles in the Header should:
- have a role of `banner` at the root of the component (<header>) (https://www.w3.org/TR/wai-aria-1.1/#banner)
examples:
- name: default
description: The standard header as used on information pages on GOV.UK
data:
{}
- name: with service name
description: If your service is more than a few pages long, you can help users understand where they are by adding the service name.
data:
serviceName: Service Name
serviceUrl: '/components/header'
- name: with service name but no service url
data:
serviceName: Service Name
- name: with navigation
data:
navigation:
- href: '#1'
text: Navigation item 1
active: true
- href: '#2'
text: Navigation item 2
- href: '#3'
text: Navigation item 3
- href: '#4'
text: Navigation item 4
- name: with custom navigation label
data:
navigationLabel: Custom navigation label
navigation:
- href: '#1'
text: Navigation item 1
active: true
- href: '#2'
text: Navigation item 2
- href: '#3'
text: Navigation item 3
- href: '#4'
text: Navigation item 4
- name: with custom menu button label
data:
menuButtonLabel: Custom button label
navigation:
- href: '#1'
text: Navigation item 1
active: true
- href: '#2'
text: Navigation item 2
- href: '#3'
text: Navigation item 3
- href: '#4'
text: Navigation item 4
- name: with service name and navigation
description: If you need to include basic navigation, contact or account management links.
data:
serviceName: Service Name
serviceUrl: '/components/header'
navigation:
- href: '#1'
text: Navigation item 1
active: true
- href: '#2'
text: Navigation item 2
- href: '#3'
text: Navigation item 3
- href: '#4'
text: Navigation item 4
- name: with large navigation
description: An edge case example with a large number of navitation items with long names used to test wrapping
data:
navigation:
- href: '/browse/benefits'
text: Benefits
- href: '/browse/births-deaths-marriages'
text: Births, deaths, marriages and care
- href: '/browse/business'
text: Business and self-employed
- href: '/browse/childcare-parenting'
text: Childcare and parenting
- href: '/browse/citizenship'
text: Citizenship and living in the UK
- href: '/browse/justice'
text: Crime, justice and the law
- href: '/browse/disabilities'
text: Disabled people
- href: '/browse/driving'
text: Driving and transport
- href: '/browse/education'
text: Education and learning
- href: '/browse/employing-people'
text: Employing people
- href: '/browse/environment-countryside'
text: Environment and countryside
- href: '/browse/housing-local-services'
text: Housing and local services
- href: '/browse/tax'
text: Money and tax
- href: '/browse/abroad'
text: Passports, travel and living abroad
- href: '/browse/visas-immigration'
text: Visas and immigration
- href: '/browse/working'
text: Working, jobs and pensions
- name: with product name
data:
navigationClasses: govuk-header__navigation--end
productName: Product Name
- name: full width
data:
containerClasses: govuk-header__container--full-width
navigationClasses: govuk-header__navigation--end
productName: Product Name
- name: full width with navigation
data:
containerClasses: govuk-header__container--full-width
navigationClasses: govuk-header__navigation--end
productName: Product Name
navigation:
- href: '#1'
text: Navigation item 1
active: true
- href: '#2'
text: Navigation item 2
- href: '#3'
text: Navigation item 3
- name: navigation item with html
data:
serviceName: Service Name
serviceUrl: '/components/header'
navigation:
- href: '#1'
html: <em>Navigation item 1</em>
active: true
- href: '#2'
html: <em>Navigation item 2</em>
- href: '#3'
html: <em>Navigation item 3</em>
- name: navigation item with text without link
data:
serviceName: Service Name
serviceUrl: '/components/header'
navigation:
- text: Navigation item 1
- text: Navigation item 2
- text: Navigation item 3
# Hidden examples are not shown in the review app, but are used for tests and HTML fixtures
- name: attributes
hidden: true
data:
attributes:
data-test-attribute: value
data-test-attribute-2: value-2
- name: classes
hidden: true
data:
classes: app-header--custom-modifier
- name: custom homepage url
hidden: true
data:
homepageUrl: /
- name: navigation item with attributes
hidden: true
data:
navigation:
- href: /link
text: Item
attributes:
data-attribute: my-attribute
data-attribute-2: my-attribute-2
- name: navigation item with html as text
hidden: true
data:
serviceName: Service Name
serviceUrl: '/components/header'
navigation:
- href: '#1'
text: <em>Navigation item 1</em>
active: true
- href: '#2'
text: <em>Navigation item 2</em>
- href: '#3'
text: <em>Navigation item 3</em>
- name: navigation item with html without link
hidden: true
data:
serviceName: Service Name
serviceUrl: '/components/header'
navigation:
- html: <em>Navigation item 1</em>
active: true
- html: <em>Navigation item 2</em>
- html: <em>Navigation item 3</em>