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,268 +1,15 @@
|
|
1
1
|
# Select
|
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 select component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/select).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Select
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/select/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<div class="govuk-form-group">
|
20
|
-
<label class="govuk-label" for="select-1">
|
21
|
-
Label text goes here
|
22
|
-
</label>
|
23
|
-
|
24
|
-
<select class="govuk-select" id="select-1" name="select-1">
|
25
|
-
|
26
|
-
<option value="1">GOV.UK frontend option 1</option>
|
27
|
-
|
28
|
-
<option value="2" selected>GOV.UK frontend option 2</option>
|
29
|
-
|
30
|
-
<option value="3" disabled>GOV.UK frontend option 3</option>
|
31
|
-
|
32
|
-
</select>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
#### Macro
|
36
|
-
|
37
|
-
{% from "select/macro.njk" import govukSelect %}
|
38
|
-
|
39
|
-
{{ govukSelect({
|
40
|
-
"id": "select-1",
|
41
|
-
"name": "select-1",
|
42
|
-
"label": {
|
43
|
-
"text": "Label text goes here"
|
44
|
-
},
|
45
|
-
"items": [
|
46
|
-
{
|
47
|
-
"value": 1,
|
48
|
-
"text": "GOV.UK frontend option 1"
|
49
|
-
},
|
50
|
-
{
|
51
|
-
"value": 2,
|
52
|
-
"text": "GOV.UK frontend option 2",
|
53
|
-
"selected": true
|
54
|
-
},
|
55
|
-
{
|
56
|
-
"value": 3,
|
57
|
-
"text": "GOV.UK frontend option 3",
|
58
|
-
"disabled": true
|
59
|
-
}
|
60
|
-
]
|
61
|
-
}) }}
|
62
|
-
|
63
|
-
### Select with hint text and error message
|
64
|
-
|
65
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/select/with-hint-text-and-error-message/preview)
|
66
|
-
|
67
|
-
#### Markup
|
68
|
-
|
69
|
-
<div class="govuk-form-group govuk-form-group--error">
|
70
|
-
<label class="govuk-label" for="select-2">
|
71
|
-
Label text goes here
|
72
|
-
</label>
|
73
|
-
|
74
|
-
<span id="select-2-hint" class="govuk-hint">
|
75
|
-
Hint text goes here
|
76
|
-
</span>
|
77
|
-
|
78
|
-
<span id="select-2-error" class="govuk-error-message">
|
79
|
-
Error message goes here
|
80
|
-
</span>
|
81
|
-
|
82
|
-
<select class="govuk-select govuk-select--error" id="select-2" name="select-2" aria-describedby="select-2-hint select-2-error">
|
83
|
-
|
84
|
-
<option value="1">GOV.UK frontend option 1</option>
|
85
|
-
|
86
|
-
<option value="2">GOV.UK frontend option 2</option>
|
87
|
-
|
88
|
-
<option value="3">GOV.UK frontend option 3</option>
|
89
|
-
|
90
|
-
</select>
|
91
|
-
</div>
|
92
|
-
|
93
|
-
#### Macro
|
94
|
-
|
95
|
-
{% from "select/macro.njk" import govukSelect %}
|
96
|
-
|
97
|
-
{{ govukSelect({
|
98
|
-
"id": "select-2",
|
99
|
-
"name": "select-2",
|
100
|
-
"label": {
|
101
|
-
"text": "Label text goes here"
|
102
|
-
},
|
103
|
-
"hint": {
|
104
|
-
"text": "Hint text goes here"
|
105
|
-
},
|
106
|
-
"errorMessage": {
|
107
|
-
"text": "Error message goes here"
|
108
|
-
},
|
109
|
-
"items": [
|
110
|
-
{
|
111
|
-
"value": 1,
|
112
|
-
"text": "GOV.UK frontend option 1"
|
113
|
-
},
|
114
|
-
{
|
115
|
-
"value": 2,
|
116
|
-
"text": "GOV.UK frontend option 2"
|
117
|
-
},
|
118
|
-
{
|
119
|
-
"value": 3,
|
120
|
-
"text": "GOV.UK frontend option 3"
|
121
|
-
}
|
122
|
-
]
|
123
|
-
}) }}
|
124
|
-
|
125
|
-
### Select with label as page heading
|
126
|
-
|
127
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/select/with-label-as-page-heading/preview)
|
128
|
-
|
129
|
-
#### Markup
|
130
|
-
|
131
|
-
<div class="govuk-form-group">
|
132
|
-
<h1 class="govuk-label-wrapper">
|
133
|
-
<label class="govuk-label" for="select-3">
|
134
|
-
Label text goes here
|
135
|
-
</label>
|
136
|
-
|
137
|
-
</h1>
|
138
|
-
|
139
|
-
<select class="govuk-select" id="select-3" name="select-3">
|
140
|
-
|
141
|
-
<option value="1">GOV.UK frontend option 1</option>
|
142
|
-
|
143
|
-
<option value="2" selected>GOV.UK frontend option 2</option>
|
144
|
-
|
145
|
-
<option value="3" disabled>GOV.UK frontend option 3</option>
|
146
|
-
|
147
|
-
</select>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
#### Macro
|
151
|
-
|
152
|
-
{% from "select/macro.njk" import govukSelect %}
|
153
|
-
|
154
|
-
{{ govukSelect({
|
155
|
-
"id": "select-3",
|
156
|
-
"name": "select-3",
|
157
|
-
"label": {
|
158
|
-
"text": "Label text goes here",
|
159
|
-
"isPageHeading": true
|
160
|
-
},
|
161
|
-
"items": [
|
162
|
-
{
|
163
|
-
"value": 1,
|
164
|
-
"text": "GOV.UK frontend option 1"
|
165
|
-
},
|
166
|
-
{
|
167
|
-
"value": 2,
|
168
|
-
"text": "GOV.UK frontend option 2",
|
169
|
-
"selected": true
|
170
|
-
},
|
171
|
-
{
|
172
|
-
"value": 3,
|
173
|
-
"text": "GOV.UK frontend option 3",
|
174
|
-
"disabled": true
|
175
|
-
}
|
176
|
-
]
|
177
|
-
}) }}
|
178
|
-
|
179
|
-
### Select with full width override
|
180
|
-
|
181
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/select/with-full-width-override/preview)
|
182
|
-
|
183
|
-
#### Markup
|
184
|
-
|
185
|
-
<div class="govuk-form-group">
|
186
|
-
<label class="govuk-label" for="select-1">
|
187
|
-
Label text goes here
|
188
|
-
</label>
|
189
|
-
|
190
|
-
<select class="govuk-select govuk-!-width-full" id="select-1" name="select-1">
|
191
|
-
|
192
|
-
<option value="1">GOV.UK frontend option 1</option>
|
193
|
-
|
194
|
-
<option value="2" selected>GOV.UK frontend option 2</option>
|
195
|
-
|
196
|
-
<option value="3" disabled>GOV.UK frontend option 3</option>
|
197
|
-
|
198
|
-
</select>
|
199
|
-
</div>
|
200
|
-
|
201
|
-
#### Macro
|
202
|
-
|
203
|
-
{% from "select/macro.njk" import govukSelect %}
|
204
|
-
|
205
|
-
{{ govukSelect({
|
206
|
-
"id": "select-1",
|
207
|
-
"name": "select-1",
|
208
|
-
"classes": "govuk-!-width-full",
|
209
|
-
"label": {
|
210
|
-
"text": "Label text goes here"
|
211
|
-
},
|
212
|
-
"items": [
|
213
|
-
{
|
214
|
-
"value": 1,
|
215
|
-
"text": "GOV.UK frontend option 1"
|
216
|
-
},
|
217
|
-
{
|
218
|
-
"value": 2,
|
219
|
-
"text": "GOV.UK frontend option 2",
|
220
|
-
"selected": true
|
221
|
-
},
|
222
|
-
{
|
223
|
-
"value": 3,
|
224
|
-
"text": "GOV.UK frontend option 3",
|
225
|
-
"disabled": true
|
226
|
-
}
|
227
|
-
]
|
228
|
-
}) }}
|
229
|
-
|
230
|
-
## Requirements
|
231
|
-
|
232
|
-
### Build tool configuration
|
233
|
-
|
234
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
235
|
-
|
236
|
-
.pipe(sass({
|
237
|
-
includePaths: 'node_modules/'
|
238
|
-
}))
|
239
|
-
|
240
|
-
### Static asset path configuration
|
241
|
-
|
242
|
-
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:
|
243
|
-
|
244
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
245
|
-
|
246
11
|
## Component options
|
247
12
|
|
248
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
249
14
|
|
250
|
-
See [options table](https://design-system.service.gov.uk/components/select/#options-example-default) for details.
|
251
|
-
|
252
|
-
### Setting up Nunjucks views and paths
|
253
|
-
|
254
|
-
Below is an example setup using express configure views:
|
255
|
-
|
256
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
257
|
-
autoescape: true,
|
258
|
-
cache: false,
|
259
|
-
express: app
|
260
|
-
})
|
261
|
-
|
262
|
-
## Contribution
|
263
|
-
|
264
|
-
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")
|
265
|
-
|
266
|
-
## License
|
267
|
-
|
268
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/select/#options-example-default) for details.
|
@@ -1,68 +1,15 @@
|
|
1
1
|
# Skip link
|
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 skip link component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/skip-link).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Skip link
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/skip-link/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<a href="#content" class="govuk-skip-link">Skip to main content</a>
|
20
|
-
|
21
|
-
#### Macro
|
22
|
-
|
23
|
-
{% from "skip-link/macro.njk" import govukSkipLink %}
|
24
|
-
|
25
|
-
{{ govukSkipLink({
|
26
|
-
"text": "Skip to main content",
|
27
|
-
"href": "#content"
|
28
|
-
}) }}
|
29
|
-
|
30
|
-
## Requirements
|
31
|
-
|
32
|
-
### Build tool configuration
|
33
|
-
|
34
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
35
|
-
|
36
|
-
.pipe(sass({
|
37
|
-
includePaths: 'node_modules/'
|
38
|
-
}))
|
39
|
-
|
40
|
-
### Static asset path configuration
|
41
|
-
|
42
|
-
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:
|
43
|
-
|
44
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
45
|
-
|
46
11
|
## Component options
|
47
12
|
|
48
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
49
14
|
|
50
|
-
See [options table](https://design-system.service.gov.uk/components/skip-link/#options-example-default) for details.
|
51
|
-
|
52
|
-
### Setting up Nunjucks views and paths
|
53
|
-
|
54
|
-
Below is an example setup using express configure views:
|
55
|
-
|
56
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
57
|
-
autoescape: true,
|
58
|
-
cache: false,
|
59
|
-
express: app
|
60
|
-
})
|
61
|
-
|
62
|
-
## Contribution
|
63
|
-
|
64
|
-
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")
|
65
|
-
|
66
|
-
## License
|
67
|
-
|
68
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/skip-link/#options-example-default) for details.
|
@@ -1,379 +1,15 @@
|
|
1
1
|
# Table
|
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 table component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/table).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Table
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/table/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<table class="govuk-table">
|
20
|
-
|
21
|
-
<tbody class="govuk-table__body">
|
22
|
-
|
23
|
-
<tr class="govuk-table__row">
|
24
|
-
|
25
|
-
<td class="govuk-table__cell">January</td>
|
26
|
-
|
27
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£85</td>
|
28
|
-
|
29
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£95</td>
|
30
|
-
|
31
|
-
</tr>
|
32
|
-
|
33
|
-
<tr class="govuk-table__row">
|
34
|
-
|
35
|
-
<td class="govuk-table__cell">February</td>
|
36
|
-
|
37
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£75</td>
|
38
|
-
|
39
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£55</td>
|
40
|
-
|
41
|
-
</tr>
|
42
|
-
|
43
|
-
<tr class="govuk-table__row">
|
44
|
-
|
45
|
-
<td class="govuk-table__cell">March</td>
|
46
|
-
|
47
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£165</td>
|
48
|
-
|
49
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£125</td>
|
50
|
-
|
51
|
-
</tr>
|
52
|
-
|
53
|
-
</tbody>
|
54
|
-
</table>
|
55
|
-
|
56
|
-
#### Macro
|
57
|
-
|
58
|
-
{% from "table/macro.njk" import govukTable %}
|
59
|
-
|
60
|
-
{{ govukTable({
|
61
|
-
"rows": [
|
62
|
-
[
|
63
|
-
{
|
64
|
-
"text": "January"
|
65
|
-
},
|
66
|
-
{
|
67
|
-
"text": "£85",
|
68
|
-
"format": "numeric"
|
69
|
-
},
|
70
|
-
{
|
71
|
-
"text": "£95",
|
72
|
-
"format": "numeric"
|
73
|
-
}
|
74
|
-
],
|
75
|
-
[
|
76
|
-
{
|
77
|
-
"text": "February"
|
78
|
-
},
|
79
|
-
{
|
80
|
-
"text": "£75",
|
81
|
-
"format": "numeric"
|
82
|
-
},
|
83
|
-
{
|
84
|
-
"text": "£55",
|
85
|
-
"format": "numeric"
|
86
|
-
}
|
87
|
-
],
|
88
|
-
[
|
89
|
-
{
|
90
|
-
"text": "March"
|
91
|
-
},
|
92
|
-
{
|
93
|
-
"text": "£165",
|
94
|
-
"format": "numeric"
|
95
|
-
},
|
96
|
-
{
|
97
|
-
"text": "£125",
|
98
|
-
"format": "numeric"
|
99
|
-
}
|
100
|
-
]
|
101
|
-
]
|
102
|
-
}) }}
|
103
|
-
|
104
|
-
### Table table with head
|
105
|
-
|
106
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/table/table-with-head/preview)
|
107
|
-
|
108
|
-
#### Markup
|
109
|
-
|
110
|
-
<table class="govuk-table">
|
111
|
-
|
112
|
-
<thead class="govuk-table__head">
|
113
|
-
<tr class="govuk-table__row">
|
114
|
-
|
115
|
-
<th class="govuk-table__header" scope="col">Month you apply</th>
|
116
|
-
|
117
|
-
<th class="govuk-table__header govuk-table__header--numeric" scope="col">Rate for bicycles</th>
|
118
|
-
|
119
|
-
<th class="govuk-table__header govuk-table__header--numeric" scope="col">Rate for vehicles</th>
|
120
|
-
|
121
|
-
</tr>
|
122
|
-
</thead>
|
123
|
-
|
124
|
-
<tbody class="govuk-table__body">
|
125
|
-
|
126
|
-
<tr class="govuk-table__row">
|
127
|
-
|
128
|
-
<td class="govuk-table__cell">January</td>
|
129
|
-
|
130
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£85</td>
|
131
|
-
|
132
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£95</td>
|
133
|
-
|
134
|
-
</tr>
|
135
|
-
|
136
|
-
<tr class="govuk-table__row">
|
137
|
-
|
138
|
-
<td class="govuk-table__cell">February</td>
|
139
|
-
|
140
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£75</td>
|
141
|
-
|
142
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£55</td>
|
143
|
-
|
144
|
-
</tr>
|
145
|
-
|
146
|
-
<tr class="govuk-table__row">
|
147
|
-
|
148
|
-
<td class="govuk-table__cell">March</td>
|
149
|
-
|
150
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£165</td>
|
151
|
-
|
152
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£125</td>
|
153
|
-
|
154
|
-
</tr>
|
155
|
-
|
156
|
-
</tbody>
|
157
|
-
</table>
|
158
|
-
|
159
|
-
#### Macro
|
160
|
-
|
161
|
-
{% from "table/macro.njk" import govukTable %}
|
162
|
-
|
163
|
-
{{ govukTable({
|
164
|
-
"head": [
|
165
|
-
{
|
166
|
-
"text": "Month you apply"
|
167
|
-
},
|
168
|
-
{
|
169
|
-
"text": "Rate for bicycles",
|
170
|
-
"format": "numeric"
|
171
|
-
},
|
172
|
-
{
|
173
|
-
"text": "Rate for vehicles",
|
174
|
-
"format": "numeric"
|
175
|
-
}
|
176
|
-
],
|
177
|
-
"rows": [
|
178
|
-
[
|
179
|
-
{
|
180
|
-
"text": "January"
|
181
|
-
},
|
182
|
-
{
|
183
|
-
"text": "£85",
|
184
|
-
"format": "numeric"
|
185
|
-
},
|
186
|
-
{
|
187
|
-
"text": "£95",
|
188
|
-
"format": "numeric"
|
189
|
-
}
|
190
|
-
],
|
191
|
-
[
|
192
|
-
{
|
193
|
-
"text": "February"
|
194
|
-
},
|
195
|
-
{
|
196
|
-
"text": "£75",
|
197
|
-
"format": "numeric"
|
198
|
-
},
|
199
|
-
{
|
200
|
-
"text": "£55",
|
201
|
-
"format": "numeric"
|
202
|
-
}
|
203
|
-
],
|
204
|
-
[
|
205
|
-
{
|
206
|
-
"text": "March"
|
207
|
-
},
|
208
|
-
{
|
209
|
-
"text": "£165",
|
210
|
-
"format": "numeric"
|
211
|
-
},
|
212
|
-
{
|
213
|
-
"text": "£125",
|
214
|
-
"format": "numeric"
|
215
|
-
}
|
216
|
-
]
|
217
|
-
]
|
218
|
-
}) }}
|
219
|
-
|
220
|
-
### Table table with head and caption
|
221
|
-
|
222
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/table/table-with-head-and-caption/preview)
|
223
|
-
|
224
|
-
#### Markup
|
225
|
-
|
226
|
-
<table class="govuk-table">
|
227
|
-
|
228
|
-
<caption class="govuk-table__caption govuk-heading-m">Caption 1: Months and rates</caption>
|
229
|
-
|
230
|
-
<thead class="govuk-table__head">
|
231
|
-
<tr class="govuk-table__row">
|
232
|
-
|
233
|
-
<th class="govuk-table__header" scope="col">Month you apply</th>
|
234
|
-
|
235
|
-
<th class="govuk-table__header govuk-table__header--numeric" scope="col">Rate for bicycles</th>
|
236
|
-
|
237
|
-
<th class="govuk-table__header govuk-table__header--numeric" scope="col">Rate for vehicles</th>
|
238
|
-
|
239
|
-
</tr>
|
240
|
-
</thead>
|
241
|
-
|
242
|
-
<tbody class="govuk-table__body">
|
243
|
-
|
244
|
-
<tr class="govuk-table__row">
|
245
|
-
|
246
|
-
<th class="govuk-table__header" scope="row">January</th>
|
247
|
-
|
248
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£85</td>
|
249
|
-
|
250
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£95</td>
|
251
|
-
|
252
|
-
</tr>
|
253
|
-
|
254
|
-
<tr class="govuk-table__row">
|
255
|
-
|
256
|
-
<th class="govuk-table__header" scope="row">February</th>
|
257
|
-
|
258
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£75</td>
|
259
|
-
|
260
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£55</td>
|
261
|
-
|
262
|
-
</tr>
|
263
|
-
|
264
|
-
<tr class="govuk-table__row">
|
265
|
-
|
266
|
-
<th class="govuk-table__header" scope="row">March</th>
|
267
|
-
|
268
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£165</td>
|
269
|
-
|
270
|
-
<td class="govuk-table__cell govuk-table__cell--numeric">£125</td>
|
271
|
-
|
272
|
-
</tr>
|
273
|
-
|
274
|
-
</tbody>
|
275
|
-
</table>
|
276
|
-
|
277
|
-
#### Macro
|
278
|
-
|
279
|
-
{% from "table/macro.njk" import govukTable %}
|
280
|
-
|
281
|
-
{{ govukTable({
|
282
|
-
"caption": "Caption 1: Months and rates",
|
283
|
-
"captionClasses": "govuk-heading-m",
|
284
|
-
"firstCellIsHeader": true,
|
285
|
-
"head": [
|
286
|
-
{
|
287
|
-
"text": "Month you apply"
|
288
|
-
},
|
289
|
-
{
|
290
|
-
"text": "Rate for bicycles",
|
291
|
-
"format": "numeric"
|
292
|
-
},
|
293
|
-
{
|
294
|
-
"text": "Rate for vehicles",
|
295
|
-
"format": "numeric"
|
296
|
-
}
|
297
|
-
],
|
298
|
-
"rows": [
|
299
|
-
[
|
300
|
-
{
|
301
|
-
"text": "January"
|
302
|
-
},
|
303
|
-
{
|
304
|
-
"text": "£85",
|
305
|
-
"format": "numeric"
|
306
|
-
},
|
307
|
-
{
|
308
|
-
"text": "£95",
|
309
|
-
"format": "numeric"
|
310
|
-
}
|
311
|
-
],
|
312
|
-
[
|
313
|
-
{
|
314
|
-
"text": "February"
|
315
|
-
},
|
316
|
-
{
|
317
|
-
"text": "£75",
|
318
|
-
"format": "numeric"
|
319
|
-
},
|
320
|
-
{
|
321
|
-
"text": "£55",
|
322
|
-
"format": "numeric"
|
323
|
-
}
|
324
|
-
],
|
325
|
-
[
|
326
|
-
{
|
327
|
-
"text": "March"
|
328
|
-
},
|
329
|
-
{
|
330
|
-
"text": "£165",
|
331
|
-
"format": "numeric"
|
332
|
-
},
|
333
|
-
{
|
334
|
-
"text": "£125",
|
335
|
-
"format": "numeric"
|
336
|
-
}
|
337
|
-
]
|
338
|
-
]
|
339
|
-
}) }}
|
340
|
-
|
341
|
-
## Requirements
|
342
|
-
|
343
|
-
### Build tool configuration
|
344
|
-
|
345
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
346
|
-
|
347
|
-
.pipe(sass({
|
348
|
-
includePaths: 'node_modules/'
|
349
|
-
}))
|
350
|
-
|
351
|
-
### Static asset path configuration
|
352
|
-
|
353
|
-
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:
|
354
|
-
|
355
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
356
|
-
|
357
11
|
## Component options
|
358
12
|
|
359
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
360
14
|
|
361
|
-
See [options table](https://design-system.service.gov.uk/components/table/#options-example-default) for details.
|
362
|
-
|
363
|
-
### Setting up Nunjucks views and paths
|
364
|
-
|
365
|
-
Below is an example setup using express configure views:
|
366
|
-
|
367
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
368
|
-
autoescape: true,
|
369
|
-
cache: false,
|
370
|
-
express: app
|
371
|
-
})
|
372
|
-
|
373
|
-
## Contribution
|
374
|
-
|
375
|
-
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")
|
376
|
-
|
377
|
-
## License
|
378
|
-
|
379
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/table/#options-example-default) for details.
|