govuk_publishing_components 12.20.0 → 12.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +8 -0
- data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +8 -8
- data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +10 -0
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -14
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +5 -3
- data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +10 -6
- data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +3 -2
- data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +71 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +18 -9
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
- data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +53 -0
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +10 -5
- data/config/locales/en.yml +5 -6
- data/lib/govuk_publishing_components.rb +0 -2
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -4
- data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +108 -90
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/components/back-link/README.md +4 -73
- data/node_modules/govuk-frontend/components/breadcrumbs/README.md +4 -238
- data/node_modules/govuk-frontend/components/button/README.md +4 -174
- data/node_modules/govuk-frontend/components/character-count/README.md +4 -340
- data/node_modules/govuk-frontend/components/character-count/template.njk +0 -3
- data/node_modules/govuk-frontend/components/checkboxes/README.md +4 -705
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +1 -0
- data/node_modules/govuk-frontend/components/date-input/README.md +4 -563
- data/node_modules/govuk-frontend/components/date-input/template.njk +1 -0
- data/node_modules/govuk-frontend/components/details/README.md +4 -128
- data/node_modules/govuk-frontend/components/error-message/README.md +4 -58
- data/node_modules/govuk-frontend/components/error-summary/README.md +4 -94
- data/node_modules/govuk-frontend/components/fieldset/README.md +4 -92
- data/node_modules/govuk-frontend/components/file-upload/README.md +4 -199
- data/node_modules/govuk-frontend/components/file-upload/template.njk +1 -0
- data/node_modules/govuk-frontend/components/footer/README.md +4 -91
- data/node_modules/govuk-frontend/components/footer/_footer.scss +22 -13
- data/node_modules/govuk-frontend/components/header/README.md +4 -351
- data/node_modules/govuk-frontend/components/hint/README.md +5 -77
- data/node_modules/govuk-frontend/components/input/README.md +4 -407
- data/node_modules/govuk-frontend/components/input/template.njk +1 -0
- data/node_modules/govuk-frontend/components/inset-text/README.md +4 -76
- data/node_modules/govuk-frontend/components/label/README.md +5 -97
- data/node_modules/govuk-frontend/components/panel/README.md +4 -93
- data/node_modules/govuk-frontend/components/phase-banner/README.md +4 -67
- data/node_modules/govuk-frontend/components/radios/README.md +4 -665
- data/node_modules/govuk-frontend/components/radios/template.njk +1 -0
- data/node_modules/govuk-frontend/components/select/README.md +4 -257
- data/node_modules/govuk-frontend/components/select/template.njk +1 -0
- data/node_modules/govuk-frontend/components/skip-link/README.md +4 -57
- data/node_modules/govuk-frontend/components/table/README.md +4 -368
- data/node_modules/govuk-frontend/components/tabs/README.md +4 -242
- data/node_modules/govuk-frontend/components/tag/README.md +4 -77
- data/node_modules/govuk-frontend/components/textarea/README.md +4 -193
- data/node_modules/govuk-frontend/components/textarea/template.njk +1 -0
- data/node_modules/govuk-frontend/components/warning-text/README.md +4 -63
- data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +1 -2
- data/node_modules/govuk-frontend/core/_lists.scss +17 -8
- data/node_modules/govuk-frontend/package.json +10 -10
- metadata +4 -5
- data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +0 -116
- data/app/views/govuk_publishing_components/components/docs/taxonomy_navigation.yml +0 -119
- data/lib/govuk_publishing_components/presenters/taxonomy_navigation.rb +0 -47
@@ -1,6 +1,3 @@
|
|
1
|
-
{% from "../error-message/macro.njk" import govukErrorMessage -%}
|
2
|
-
{% from "../hint/macro.njk" import govukHint %}
|
3
|
-
{% from "../label/macro.njk" import govukLabel %}
|
4
1
|
{% from "../textarea/macro.njk" import govukTextarea %}
|
5
2
|
|
6
3
|
<div class="govuk-character-count" data-module="character-count"
|
@@ -1,716 +1,15 @@
|
|
1
1
|
# Checkboxes
|
2
2
|
|
3
|
-
##
|
3
|
+
## Installation
|
4
4
|
|
5
|
-
|
5
|
+
See the [main README quick start guide](https://github.com/alphagov/govuk-frontend#quick-start) for how to install this component.
|
6
6
|
|
7
|
-
## Guidance
|
7
|
+
## Guidance and Examples
|
8
8
|
|
9
9
|
Find out when to use the checkboxes component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/checkboxes).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Checkboxes
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<div class="govuk-form-group">
|
20
|
-
|
21
|
-
<fieldset class="govuk-fieldset" aria-describedby="nationality-hint">
|
22
|
-
|
23
|
-
<legend class="govuk-fieldset__legend">
|
24
|
-
What is your nationality?
|
25
|
-
</legend>
|
26
|
-
|
27
|
-
<span id="nationality-hint" class="govuk-hint">
|
28
|
-
If you have dual nationality, select all options that are relevant to you.
|
29
|
-
</span>
|
30
|
-
|
31
|
-
<div class="govuk-checkboxes">
|
32
|
-
|
33
|
-
<div class="govuk-checkboxes__item">
|
34
|
-
<input class="govuk-checkboxes__input" id="nationality-1" name="nationality" type="checkbox" value="british">
|
35
|
-
<label class="govuk-label govuk-checkboxes__label" for="nationality-1">
|
36
|
-
British
|
37
|
-
</label>
|
38
|
-
</div>
|
39
|
-
|
40
|
-
<div class="govuk-checkboxes__item">
|
41
|
-
<input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="irish">
|
42
|
-
<label class="govuk-label govuk-checkboxes__label" for="nationality-2">
|
43
|
-
Irish
|
44
|
-
</label>
|
45
|
-
</div>
|
46
|
-
|
47
|
-
<div class="govuk-checkboxes__item">
|
48
|
-
<input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="other">
|
49
|
-
<label class="govuk-label govuk-checkboxes__label" for="nationality-3">
|
50
|
-
Citizen of another country
|
51
|
-
</label>
|
52
|
-
</div>
|
53
|
-
|
54
|
-
</div>
|
55
|
-
</fieldset>
|
56
|
-
|
57
|
-
</div>
|
58
|
-
|
59
|
-
#### Macro
|
60
|
-
|
61
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
62
|
-
|
63
|
-
{{ govukCheckboxes({
|
64
|
-
"idPrefix": "nationality",
|
65
|
-
"name": "nationality",
|
66
|
-
"fieldset": {
|
67
|
-
"legend": {
|
68
|
-
"text": "What is your nationality?"
|
69
|
-
}
|
70
|
-
},
|
71
|
-
"hint": {
|
72
|
-
"text": "If you have dual nationality, select all options that are relevant to you."
|
73
|
-
},
|
74
|
-
"items": [
|
75
|
-
{
|
76
|
-
"value": "british",
|
77
|
-
"text": "British"
|
78
|
-
},
|
79
|
-
{
|
80
|
-
"value": "irish",
|
81
|
-
"text": "Irish"
|
82
|
-
},
|
83
|
-
{
|
84
|
-
"value": "other",
|
85
|
-
"text": "Citizen of another country"
|
86
|
-
}
|
87
|
-
]
|
88
|
-
}) }}
|
89
|
-
|
90
|
-
### Checkboxes with id and name
|
91
|
-
|
92
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-id-and-name/preview)
|
93
|
-
|
94
|
-
#### Markup
|
95
|
-
|
96
|
-
<div class="govuk-form-group">
|
97
|
-
|
98
|
-
<fieldset class="govuk-fieldset" aria-describedby="undefined-hint">
|
99
|
-
|
100
|
-
<legend class="govuk-fieldset__legend">
|
101
|
-
What is your nationality?
|
102
|
-
</legend>
|
103
|
-
|
104
|
-
<span id="undefined-hint" class="govuk-hint">
|
105
|
-
If you have dual nationality, select all options that are relevant to you.
|
106
|
-
</span>
|
107
|
-
|
108
|
-
<div class="govuk-checkboxes">
|
109
|
-
|
110
|
-
<div class="govuk-checkboxes__item">
|
111
|
-
<input class="govuk-checkboxes__input" id="item_british" name="british" type="checkbox" value="yes">
|
112
|
-
<label class="govuk-label govuk-checkboxes__label" for="item_british">
|
113
|
-
British
|
114
|
-
</label>
|
115
|
-
</div>
|
116
|
-
|
117
|
-
<div class="govuk-checkboxes__item">
|
118
|
-
<input class="govuk-checkboxes__input" id="item_irish" name="irish" type="checkbox" value="irish">
|
119
|
-
<label class="govuk-label govuk-checkboxes__label" for="item_irish">
|
120
|
-
Irish
|
121
|
-
</label>
|
122
|
-
</div>
|
123
|
-
|
124
|
-
</div>
|
125
|
-
</fieldset>
|
126
|
-
|
127
|
-
</div>
|
128
|
-
|
129
|
-
#### Macro
|
130
|
-
|
131
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
132
|
-
|
133
|
-
{{ govukCheckboxes({
|
134
|
-
"fieldset": {
|
135
|
-
"legend": {
|
136
|
-
"text": "What is your nationality?"
|
137
|
-
}
|
138
|
-
},
|
139
|
-
"hint": {
|
140
|
-
"text": "If you have dual nationality, select all options that are relevant to you."
|
141
|
-
},
|
142
|
-
"items": [
|
143
|
-
{
|
144
|
-
"name": "british",
|
145
|
-
"id": "item_british",
|
146
|
-
"value": "yes",
|
147
|
-
"text": "British"
|
148
|
-
},
|
149
|
-
{
|
150
|
-
"name": "irish",
|
151
|
-
"id": "item_irish",
|
152
|
-
"value": "irish",
|
153
|
-
"text": "Irish"
|
154
|
-
}
|
155
|
-
]
|
156
|
-
}) }}
|
157
|
-
|
158
|
-
### Checkboxes with hints on items
|
159
|
-
|
160
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-hints-on-items/preview)
|
161
|
-
|
162
|
-
#### Markup
|
163
|
-
|
164
|
-
<div class="govuk-form-group">
|
165
|
-
|
166
|
-
<fieldset class="govuk-fieldset">
|
167
|
-
|
168
|
-
<legend class="govuk-fieldset__legend">
|
169
|
-
<h1 class="govuk-fieldset__heading">
|
170
|
-
How do you want to sign in?
|
171
|
-
</h1>
|
172
|
-
</legend>
|
173
|
-
|
174
|
-
<div class="govuk-checkboxes">
|
175
|
-
|
176
|
-
<div class="govuk-checkboxes__item">
|
177
|
-
<input class="govuk-checkboxes__input" id="government-gateway" name="gateway" type="checkbox" value="gov-gateway" aria-describedby="government-gateway-item-hint">
|
178
|
-
<label class="govuk-label govuk-checkboxes__label" for="government-gateway">
|
179
|
-
Sign in with Government Gateway
|
180
|
-
</label>
|
181
|
-
<span id="government-gateway-item-hint" class="govuk-hint govuk-checkboxes__hint">
|
182
|
-
You’ll have a user ID if you’ve registered for Self Assessment or filed a tax return online before.
|
183
|
-
</span>
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div class="govuk-checkboxes__item">
|
187
|
-
<input class="govuk-checkboxes__input" id="govuk-verify" name="verify" type="checkbox" value="gov-verify" aria-describedby="govuk-verify-item-hint">
|
188
|
-
<label class="govuk-label govuk-checkboxes__label" for="govuk-verify">
|
189
|
-
Sign in with GOV.UK Verify
|
190
|
-
</label>
|
191
|
-
<span id="govuk-verify-item-hint" class="govuk-hint govuk-checkboxes__hint">
|
192
|
-
You’ll have an account if you’ve already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity.
|
193
|
-
</span>
|
194
|
-
</div>
|
195
|
-
|
196
|
-
</div>
|
197
|
-
</fieldset>
|
198
|
-
|
199
|
-
</div>
|
200
|
-
|
201
|
-
#### Macro
|
202
|
-
|
203
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
204
|
-
|
205
|
-
{{ govukCheckboxes({
|
206
|
-
"fieldset": {
|
207
|
-
"legend": {
|
208
|
-
"text": "How do you want to sign in?",
|
209
|
-
"isPageHeading": true
|
210
|
-
}
|
211
|
-
},
|
212
|
-
"items": [
|
213
|
-
{
|
214
|
-
"name": "gateway",
|
215
|
-
"id": "government-gateway",
|
216
|
-
"value": "gov-gateway",
|
217
|
-
"text": "Sign in with Government Gateway",
|
218
|
-
"hint": {
|
219
|
-
"text": "You’ll have a user ID if you’ve registered for Self Assessment or filed a tax return online before."
|
220
|
-
}
|
221
|
-
},
|
222
|
-
{
|
223
|
-
"name": "verify",
|
224
|
-
"id": "govuk-verify",
|
225
|
-
"value": "gov-verify",
|
226
|
-
"text": "Sign in with GOV.UK Verify",
|
227
|
-
"hint": {
|
228
|
-
"text": "You’ll have an account if you’ve already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity."
|
229
|
-
}
|
230
|
-
}
|
231
|
-
]
|
232
|
-
}) }}
|
233
|
-
|
234
|
-
### Checkboxes with disabled item
|
235
|
-
|
236
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-disabled-item/preview)
|
237
|
-
|
238
|
-
#### Markup
|
239
|
-
|
240
|
-
<div class="govuk-form-group">
|
241
|
-
|
242
|
-
<div class="govuk-checkboxes">
|
243
|
-
|
244
|
-
<div class="govuk-checkboxes__item">
|
245
|
-
<input class="govuk-checkboxes__input" id="colours-1" name="colours" type="checkbox" value="red">
|
246
|
-
<label class="govuk-label govuk-checkboxes__label" for="colours-1">
|
247
|
-
Red
|
248
|
-
</label>
|
249
|
-
</div>
|
250
|
-
|
251
|
-
<div class="govuk-checkboxes__item">
|
252
|
-
<input class="govuk-checkboxes__input" id="colours-2" name="colours" type="checkbox" value="green">
|
253
|
-
<label class="govuk-label govuk-checkboxes__label" for="colours-2">
|
254
|
-
Green
|
255
|
-
</label>
|
256
|
-
</div>
|
257
|
-
|
258
|
-
<div class="govuk-checkboxes__item">
|
259
|
-
<input class="govuk-checkboxes__input" id="colours-3" name="colours" type="checkbox" value="blue" disabled>
|
260
|
-
<label class="govuk-label govuk-checkboxes__label" for="colours-3">
|
261
|
-
Blue
|
262
|
-
</label>
|
263
|
-
</div>
|
264
|
-
|
265
|
-
</div>
|
266
|
-
|
267
|
-
</div>
|
268
|
-
|
269
|
-
#### Macro
|
270
|
-
|
271
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
272
|
-
|
273
|
-
{{ govukCheckboxes({
|
274
|
-
"name": "colours",
|
275
|
-
"items": [
|
276
|
-
{
|
277
|
-
"value": "red",
|
278
|
-
"text": "Red"
|
279
|
-
},
|
280
|
-
{
|
281
|
-
"value": "green",
|
282
|
-
"text": "Green"
|
283
|
-
},
|
284
|
-
{
|
285
|
-
"value": "blue",
|
286
|
-
"text": "Blue",
|
287
|
-
"disabled": true
|
288
|
-
}
|
289
|
-
]
|
290
|
-
}) }}
|
291
|
-
|
292
|
-
### Checkboxes with legend as a page heading
|
293
|
-
|
294
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-legend-as-a-page-heading/preview)
|
295
|
-
|
296
|
-
#### Markup
|
297
|
-
|
298
|
-
<div class="govuk-form-group">
|
299
|
-
|
300
|
-
<fieldset class="govuk-fieldset" aria-describedby="waste-hint">
|
301
|
-
|
302
|
-
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
|
303
|
-
<h1 class="govuk-fieldset__heading">
|
304
|
-
Which types of waste do you transport regularly?
|
305
|
-
</h1>
|
306
|
-
</legend>
|
307
|
-
|
308
|
-
<span id="waste-hint" class="govuk-hint">
|
309
|
-
Select all that apply
|
310
|
-
</span>
|
311
|
-
|
312
|
-
<div class="govuk-checkboxes">
|
313
|
-
|
314
|
-
<div class="govuk-checkboxes__item">
|
315
|
-
<input class="govuk-checkboxes__input" id="waste-1" name="waste" type="checkbox" value="animal">
|
316
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-1">
|
317
|
-
Waste from animal carcasses
|
318
|
-
</label>
|
319
|
-
</div>
|
320
|
-
|
321
|
-
<div class="govuk-checkboxes__item">
|
322
|
-
<input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
|
323
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-2">
|
324
|
-
Waste from mines or quarries
|
325
|
-
</label>
|
326
|
-
</div>
|
327
|
-
|
328
|
-
<div class="govuk-checkboxes__item">
|
329
|
-
<input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
|
330
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-3">
|
331
|
-
Farm or agricultural waste
|
332
|
-
</label>
|
333
|
-
</div>
|
334
|
-
|
335
|
-
</div>
|
336
|
-
</fieldset>
|
337
|
-
|
338
|
-
</div>
|
339
|
-
|
340
|
-
#### Macro
|
341
|
-
|
342
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
343
|
-
|
344
|
-
{{ govukCheckboxes({
|
345
|
-
"name": "waste",
|
346
|
-
"fieldset": {
|
347
|
-
"legend": {
|
348
|
-
"text": "Which types of waste do you transport regularly?",
|
349
|
-
"classes": "govuk-fieldset__legend--l",
|
350
|
-
"isPageHeading": true
|
351
|
-
}
|
352
|
-
},
|
353
|
-
"hint": {
|
354
|
-
"text": "Select all that apply"
|
355
|
-
},
|
356
|
-
"items": [
|
357
|
-
{
|
358
|
-
"value": "animal",
|
359
|
-
"text": "Waste from animal carcasses"
|
360
|
-
},
|
361
|
-
{
|
362
|
-
"value": "mines",
|
363
|
-
"text": "Waste from mines or quarries"
|
364
|
-
},
|
365
|
-
{
|
366
|
-
"value": "farm",
|
367
|
-
"text": "Farm or agricultural waste"
|
368
|
-
}
|
369
|
-
]
|
370
|
-
}) }}
|
371
|
-
|
372
|
-
### Checkboxes with a medium legend
|
373
|
-
|
374
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-a-medium-legend/preview)
|
375
|
-
|
376
|
-
#### Markup
|
377
|
-
|
378
|
-
<div class="govuk-form-group govuk-form-group--error">
|
379
|
-
|
380
|
-
<fieldset class="govuk-fieldset" aria-describedby="waste-hint waste-error">
|
381
|
-
|
382
|
-
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
|
383
|
-
Which types of waste do you transport regularly?
|
384
|
-
</legend>
|
385
|
-
|
386
|
-
<span id="waste-hint" class="govuk-hint">
|
387
|
-
Select all that apply
|
388
|
-
</span>
|
389
|
-
|
390
|
-
<span id="waste-error" class="govuk-error-message">
|
391
|
-
Select which types of waste you transport regularly
|
392
|
-
</span>
|
393
|
-
|
394
|
-
<div class="govuk-checkboxes">
|
395
|
-
|
396
|
-
<div class="govuk-checkboxes__item">
|
397
|
-
<input class="govuk-checkboxes__input" id="waste-1" name="waste" type="checkbox" value="animal">
|
398
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-1">
|
399
|
-
Waste from animal carcasses
|
400
|
-
</label>
|
401
|
-
</div>
|
402
|
-
|
403
|
-
<div class="govuk-checkboxes__item">
|
404
|
-
<input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
|
405
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-2">
|
406
|
-
Waste from mines or quarries
|
407
|
-
</label>
|
408
|
-
</div>
|
409
|
-
|
410
|
-
<div class="govuk-checkboxes__item">
|
411
|
-
<input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
|
412
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-3">
|
413
|
-
Farm or agricultural waste
|
414
|
-
</label>
|
415
|
-
</div>
|
416
|
-
|
417
|
-
</div>
|
418
|
-
</fieldset>
|
419
|
-
|
420
|
-
</div>
|
421
|
-
|
422
|
-
#### Macro
|
423
|
-
|
424
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
425
|
-
|
426
|
-
{{ govukCheckboxes({
|
427
|
-
"name": "waste",
|
428
|
-
"fieldset": {
|
429
|
-
"legend": {
|
430
|
-
"text": "Which types of waste do you transport regularly?",
|
431
|
-
"classes": "govuk-fieldset__legend--m"
|
432
|
-
}
|
433
|
-
},
|
434
|
-
"hint": {
|
435
|
-
"text": "Select all that apply"
|
436
|
-
},
|
437
|
-
"errorMessage": {
|
438
|
-
"text": "Select which types of waste you transport regularly"
|
439
|
-
},
|
440
|
-
"items": [
|
441
|
-
{
|
442
|
-
"value": "animal",
|
443
|
-
"text": "Waste from animal carcasses"
|
444
|
-
},
|
445
|
-
{
|
446
|
-
"value": "mines",
|
447
|
-
"text": "Waste from mines or quarries"
|
448
|
-
},
|
449
|
-
{
|
450
|
-
"value": "farm",
|
451
|
-
"text": "Farm or agricultural waste"
|
452
|
-
}
|
453
|
-
]
|
454
|
-
}) }}
|
455
|
-
|
456
|
-
### Checkboxes without fieldset
|
457
|
-
|
458
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/without-fieldset/preview)
|
459
|
-
|
460
|
-
#### Markup
|
461
|
-
|
462
|
-
<div class="govuk-form-group">
|
463
|
-
|
464
|
-
<div class="govuk-checkboxes">
|
465
|
-
|
466
|
-
<div class="govuk-checkboxes__item">
|
467
|
-
<input class="govuk-checkboxes__input" id="colours-1" name="colours" type="checkbox" value="red">
|
468
|
-
<label class="govuk-label govuk-checkboxes__label" for="colours-1">
|
469
|
-
Red
|
470
|
-
</label>
|
471
|
-
</div>
|
472
|
-
|
473
|
-
<div class="govuk-checkboxes__item">
|
474
|
-
<input class="govuk-checkboxes__input" id="colours-2" name="colours" type="checkbox" value="green">
|
475
|
-
<label class="govuk-label govuk-checkboxes__label" for="colours-2">
|
476
|
-
Green
|
477
|
-
</label>
|
478
|
-
</div>
|
479
|
-
|
480
|
-
<div class="govuk-checkboxes__item">
|
481
|
-
<input class="govuk-checkboxes__input" id="colours-3" name="colours" type="checkbox" value="blue">
|
482
|
-
<label class="govuk-label govuk-checkboxes__label" for="colours-3">
|
483
|
-
Blue
|
484
|
-
</label>
|
485
|
-
</div>
|
486
|
-
|
487
|
-
</div>
|
488
|
-
|
489
|
-
</div>
|
490
|
-
|
491
|
-
#### Macro
|
492
|
-
|
493
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
494
|
-
|
495
|
-
{{ govukCheckboxes({
|
496
|
-
"name": "colours",
|
497
|
-
"items": [
|
498
|
-
{
|
499
|
-
"value": "red",
|
500
|
-
"text": "Red"
|
501
|
-
},
|
502
|
-
{
|
503
|
-
"value": "green",
|
504
|
-
"text": "Green"
|
505
|
-
},
|
506
|
-
{
|
507
|
-
"value": "blue",
|
508
|
-
"text": "Blue"
|
509
|
-
}
|
510
|
-
]
|
511
|
-
}) }}
|
512
|
-
|
513
|
-
### Checkboxes with all fieldset attributes
|
514
|
-
|
515
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-all-fieldset-attributes/preview)
|
516
|
-
|
517
|
-
#### Markup
|
518
|
-
|
519
|
-
<div class="govuk-form-group govuk-form-group--error">
|
520
|
-
|
521
|
-
<fieldset class="govuk-fieldset app-fieldset--custom-modifier" aria-describedby="example-hint example-error" data-attribute="value" data-second-attribute="second-value">
|
522
|
-
|
523
|
-
<legend class="govuk-fieldset__legend">
|
524
|
-
What is your nationality?
|
525
|
-
</legend>
|
526
|
-
|
527
|
-
<span id="example-hint" class="govuk-hint">
|
528
|
-
If you have dual nationality, select all options that are relevant to you.
|
529
|
-
</span>
|
530
|
-
|
531
|
-
<span id="example-error" class="govuk-error-message">
|
532
|
-
Please select an option
|
533
|
-
</span>
|
534
|
-
|
535
|
-
<div class="govuk-checkboxes">
|
536
|
-
|
537
|
-
<div class="govuk-checkboxes__item">
|
538
|
-
<input class="govuk-checkboxes__input" id="example-1" name="example" type="checkbox" value="british">
|
539
|
-
<label class="govuk-label govuk-checkboxes__label" for="example-1">
|
540
|
-
British
|
541
|
-
</label>
|
542
|
-
</div>
|
543
|
-
|
544
|
-
<div class="govuk-checkboxes__item">
|
545
|
-
<input class="govuk-checkboxes__input" id="example-2" name="example" type="checkbox" value="irish">
|
546
|
-
<label class="govuk-label govuk-checkboxes__label" for="example-2">
|
547
|
-
Irish
|
548
|
-
</label>
|
549
|
-
</div>
|
550
|
-
|
551
|
-
<div class="govuk-checkboxes__item">
|
552
|
-
<input class="govuk-checkboxes__input" id="example-3" name="example" type="checkbox" value="other">
|
553
|
-
<label class="govuk-label govuk-checkboxes__label" for="example-3">
|
554
|
-
Citizen of another country
|
555
|
-
</label>
|
556
|
-
</div>
|
557
|
-
|
558
|
-
</div>
|
559
|
-
</fieldset>
|
560
|
-
|
561
|
-
</div>
|
562
|
-
|
563
|
-
#### Macro
|
564
|
-
|
565
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
566
|
-
|
567
|
-
{{ govukCheckboxes({
|
568
|
-
"idPrefix": "example",
|
569
|
-
"name": "example",
|
570
|
-
"fieldset": {
|
571
|
-
"classes": "app-fieldset--custom-modifier",
|
572
|
-
"attributes": {
|
573
|
-
"data-attribute": "value",
|
574
|
-
"data-second-attribute": "second-value"
|
575
|
-
},
|
576
|
-
"legend": {
|
577
|
-
"text": "What is your nationality?"
|
578
|
-
}
|
579
|
-
},
|
580
|
-
"hint": {
|
581
|
-
"text": "If you have dual nationality, select all options that are relevant to you."
|
582
|
-
},
|
583
|
-
"errorMessage": {
|
584
|
-
"text": "Please select an option"
|
585
|
-
},
|
586
|
-
"items": [
|
587
|
-
{
|
588
|
-
"value": "british",
|
589
|
-
"text": "British"
|
590
|
-
},
|
591
|
-
{
|
592
|
-
"value": "irish",
|
593
|
-
"text": "Irish"
|
594
|
-
},
|
595
|
-
{
|
596
|
-
"value": "other",
|
597
|
-
"text": "Citizen of another country"
|
598
|
-
}
|
599
|
-
]
|
600
|
-
}) }}
|
601
|
-
|
602
|
-
### Checkboxes with error message
|
603
|
-
|
604
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-error-message/preview)
|
605
|
-
|
606
|
-
#### Markup
|
607
|
-
|
608
|
-
<div class="govuk-form-group govuk-form-group--error">
|
609
|
-
|
610
|
-
<fieldset class="govuk-fieldset" aria-describedby="waste-error">
|
611
|
-
|
612
|
-
<legend class="govuk-fieldset__legend">
|
613
|
-
Which types of waste do you transport regularly?
|
614
|
-
</legend>
|
615
|
-
|
616
|
-
<span id="waste-error" class="govuk-error-message">
|
617
|
-
Please select an option
|
618
|
-
</span>
|
619
|
-
|
620
|
-
<div class="govuk-checkboxes">
|
621
|
-
|
622
|
-
<div class="govuk-checkboxes__item">
|
623
|
-
<input class="govuk-checkboxes__input" id="waste-1" name="waste" type="checkbox" value="animal">
|
624
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-1">
|
625
|
-
Waste from animal carcasses
|
626
|
-
</label>
|
627
|
-
</div>
|
628
|
-
|
629
|
-
<div class="govuk-checkboxes__item">
|
630
|
-
<input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
|
631
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-2">
|
632
|
-
Waste from mines or quarries
|
633
|
-
</label>
|
634
|
-
</div>
|
635
|
-
|
636
|
-
<div class="govuk-checkboxes__item">
|
637
|
-
<input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
|
638
|
-
<label class="govuk-label govuk-checkboxes__label" for="waste-3">
|
639
|
-
Farm or agricultural waste
|
640
|
-
</label>
|
641
|
-
</div>
|
642
|
-
|
643
|
-
</div>
|
644
|
-
</fieldset>
|
645
|
-
|
646
|
-
</div>
|
647
|
-
|
648
|
-
#### Macro
|
649
|
-
|
650
|
-
{% from "checkboxes/macro.njk" import govukCheckboxes %}
|
651
|
-
|
652
|
-
{{ govukCheckboxes({
|
653
|
-
"name": "waste",
|
654
|
-
"errorMessage": {
|
655
|
-
"text": "Please select an option"
|
656
|
-
},
|
657
|
-
"fieldset": {
|
658
|
-
"legend": {
|
659
|
-
"text": "Which types of waste do you transport regularly?"
|
660
|
-
}
|
661
|
-
},
|
662
|
-
"items": [
|
663
|
-
{
|
664
|
-
"value": "animal",
|
665
|
-
"text": "Waste from animal carcasses"
|
666
|
-
},
|
667
|
-
{
|
668
|
-
"value": "mines",
|
669
|
-
"text": "Waste from mines or quarries"
|
670
|
-
},
|
671
|
-
{
|
672
|
-
"value": "farm",
|
673
|
-
"text": "Farm or agricultural waste"
|
674
|
-
}
|
675
|
-
]
|
676
|
-
}) }}
|
677
|
-
|
678
|
-
## Requirements
|
679
|
-
|
680
|
-
### Build tool configuration
|
681
|
-
|
682
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
683
|
-
|
684
|
-
.pipe(sass({
|
685
|
-
includePaths: 'node_modules/'
|
686
|
-
}))
|
687
|
-
|
688
|
-
### Static asset path configuration
|
689
|
-
|
690
|
-
In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js:
|
691
|
-
|
692
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
693
|
-
|
694
11
|
## Component options
|
695
12
|
|
696
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
697
14
|
|
698
|
-
See [options table](https://design-system.service.gov.uk/components/checkboxes/#options-example-default) for details.
|
699
|
-
|
700
|
-
### Setting up Nunjucks views and paths
|
701
|
-
|
702
|
-
Below is an example setup using express configure views:
|
703
|
-
|
704
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
705
|
-
autoescape: true,
|
706
|
-
cache: false,
|
707
|
-
express: app
|
708
|
-
})
|
709
|
-
|
710
|
-
## Contribution
|
711
|
-
|
712
|
-
Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository")
|
713
|
-
|
714
|
-
## License
|
715
|
-
|
716
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/checkboxes/#options-example-default) for details.
|