govuk_publishing_components 12.20.0 → 12.21.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,87 +1,15 @@
|
|
1
1
|
# Hint
|
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
|
-
##
|
7
|
+
## Guidance and Examples
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/hint/preview)
|
12
|
-
|
13
|
-
#### Markup
|
14
|
-
|
15
|
-
<span class="govuk-hint">
|
16
|
-
It’s on your National Insurance card, benefit letter, payslip or P60.
|
17
|
-
For example, ‘QQ 12 34 56 C’.
|
18
|
-
|
19
|
-
</span>
|
20
|
-
|
21
|
-
#### Macro
|
22
|
-
|
23
|
-
{% from "hint/macro.njk" import govukHint %}
|
24
|
-
|
25
|
-
{{ govukHint({
|
26
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60.\nFor example, ‘QQ 12 34 56 C’.\n"
|
27
|
-
}) }}
|
28
|
-
|
29
|
-
### Hint with html
|
30
|
-
|
31
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/hint/with-html/preview)
|
32
|
-
|
33
|
-
#### Markup
|
34
|
-
|
35
|
-
<span class="govuk-hint">
|
36
|
-
It’s on your National Insurance card, benefit letter, payslip or <a class="govuk-link" href="#">P60</a>.
|
37
|
-
For example, ‘QQ 12 34 56 C’.
|
38
|
-
|
39
|
-
</span>
|
40
|
-
|
41
|
-
#### Macro
|
42
|
-
|
43
|
-
{% from "hint/macro.njk" import govukHint %}
|
44
|
-
|
45
|
-
{{ govukHint({
|
46
|
-
"html": "It’s on your National Insurance card, benefit letter, payslip or <a class=\"govuk-link\" href=\"#\">P60</a>.\nFor example, ‘QQ 12 34 56 C’.\n"
|
47
|
-
}) }}
|
48
|
-
|
49
|
-
## Requirements
|
50
|
-
|
51
|
-
### Build tool configuration
|
52
|
-
|
53
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
54
|
-
|
55
|
-
.pipe(sass({
|
56
|
-
includePaths: 'node_modules/'
|
57
|
-
}))
|
58
|
-
|
59
|
-
### Static asset path configuration
|
60
|
-
|
61
|
-
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:
|
62
|
-
|
63
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
9
|
+
The label component is used in other input components, to see an example of it in use see the [text input component](https://design-system.service.gov.uk/components/text-input/#using-hint-text).
|
64
10
|
|
65
11
|
## Component options
|
66
12
|
|
67
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
68
14
|
|
69
|
-
See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default--hint) for details.
|
70
|
-
|
71
|
-
### Setting up Nunjucks views and paths
|
72
|
-
|
73
|
-
Below is an example setup using express configure views:
|
74
|
-
|
75
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
76
|
-
autoescape: true,
|
77
|
-
cache: false,
|
78
|
-
express: app
|
79
|
-
})
|
80
|
-
|
81
|
-
## Contribution
|
82
|
-
|
83
|
-
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")
|
84
|
-
|
85
|
-
## License
|
86
|
-
|
87
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default--hint) for details.
|
@@ -1,418 +1,15 @@
|
|
1
1
|
# Input
|
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 input component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/text-input).
|
10
10
|
|
11
|
-
## Quick start examples
|
12
|
-
|
13
|
-
### Input
|
14
|
-
|
15
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/preview)
|
16
|
-
|
17
|
-
#### Markup
|
18
|
-
|
19
|
-
<div class="govuk-form-group">
|
20
|
-
<label class="govuk-label" for="input-example">
|
21
|
-
National Insurance number
|
22
|
-
</label>
|
23
|
-
|
24
|
-
<input class="govuk-input" id="input-example" name="test-name" type="text">
|
25
|
-
</div>
|
26
|
-
|
27
|
-
#### Macro
|
28
|
-
|
29
|
-
{% from "input/macro.njk" import govukInput %}
|
30
|
-
|
31
|
-
{{ govukInput({
|
32
|
-
"label": {
|
33
|
-
"text": "National Insurance number"
|
34
|
-
},
|
35
|
-
"id": "input-example",
|
36
|
-
"name": "test-name"
|
37
|
-
}) }}
|
38
|
-
|
39
|
-
### Input with hint text
|
40
|
-
|
41
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-hint-text/preview)
|
42
|
-
|
43
|
-
#### Markup
|
44
|
-
|
45
|
-
<div class="govuk-form-group">
|
46
|
-
<label class="govuk-label" for="input-with-hint-text">
|
47
|
-
National insurance number
|
48
|
-
</label>
|
49
|
-
|
50
|
-
<span id="input-with-hint-text-hint" class="govuk-hint">
|
51
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
52
|
-
</span>
|
53
|
-
|
54
|
-
<input class="govuk-input" id="input-with-hint-text" name="test-name-2" type="text" aria-describedby="input-with-hint-text-hint">
|
55
|
-
</div>
|
56
|
-
|
57
|
-
#### Macro
|
58
|
-
|
59
|
-
{% from "input/macro.njk" import govukInput %}
|
60
|
-
|
61
|
-
{{ govukInput({
|
62
|
-
"label": {
|
63
|
-
"text": "National insurance number"
|
64
|
-
},
|
65
|
-
"hint": {
|
66
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
67
|
-
},
|
68
|
-
"id": "input-with-hint-text",
|
69
|
-
"name": "test-name-2"
|
70
|
-
}) }}
|
71
|
-
|
72
|
-
### Input with error message
|
73
|
-
|
74
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-error-message/preview)
|
75
|
-
|
76
|
-
#### Markup
|
77
|
-
|
78
|
-
<div class="govuk-form-group govuk-form-group--error">
|
79
|
-
<label class="govuk-label" for="input-with-error-message">
|
80
|
-
National Insurance number
|
81
|
-
</label>
|
82
|
-
|
83
|
-
<span id="input-with-error-message-hint" class="govuk-hint">
|
84
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
85
|
-
</span>
|
86
|
-
|
87
|
-
<span id="input-with-error-message-error" class="govuk-error-message">
|
88
|
-
Error message goes here
|
89
|
-
</span>
|
90
|
-
|
91
|
-
<input class="govuk-input govuk-input--error" id="input-with-error-message" name="test-name-3" type="text" aria-describedby="input-with-error-message-hint input-with-error-message-error">
|
92
|
-
</div>
|
93
|
-
|
94
|
-
#### Macro
|
95
|
-
|
96
|
-
{% from "input/macro.njk" import govukInput %}
|
97
|
-
|
98
|
-
{{ govukInput({
|
99
|
-
"label": {
|
100
|
-
"text": "National Insurance number"
|
101
|
-
},
|
102
|
-
"hint": {
|
103
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
104
|
-
},
|
105
|
-
"id": "input-with-error-message",
|
106
|
-
"name": "test-name-3",
|
107
|
-
"errorMessage": {
|
108
|
-
"text": "Error message goes here"
|
109
|
-
}
|
110
|
-
}) }}
|
111
|
-
|
112
|
-
### Input with width-2 class
|
113
|
-
|
114
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-2-class/preview)
|
115
|
-
|
116
|
-
#### Markup
|
117
|
-
|
118
|
-
<div class="govuk-form-group">
|
119
|
-
<label class="govuk-label" for="input-width-2">
|
120
|
-
National insurance number
|
121
|
-
</label>
|
122
|
-
|
123
|
-
<span id="input-width-2-hint" class="govuk-hint">
|
124
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
125
|
-
</span>
|
126
|
-
|
127
|
-
<input class="govuk-input govuk-input--width-2" id="input-width-2" name="test-width-2" type="text" aria-describedby="input-width-2-hint">
|
128
|
-
</div>
|
129
|
-
|
130
|
-
#### Macro
|
131
|
-
|
132
|
-
{% from "input/macro.njk" import govukInput %}
|
133
|
-
|
134
|
-
{{ govukInput({
|
135
|
-
"label": {
|
136
|
-
"text": "National insurance number"
|
137
|
-
},
|
138
|
-
"hint": {
|
139
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
140
|
-
},
|
141
|
-
"id": "input-width-2",
|
142
|
-
"name": "test-width-2",
|
143
|
-
"classes": "govuk-input--width-2"
|
144
|
-
}) }}
|
145
|
-
|
146
|
-
### Input with width-3 class
|
147
|
-
|
148
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-3-class/preview)
|
149
|
-
|
150
|
-
#### Markup
|
151
|
-
|
152
|
-
<div class="govuk-form-group">
|
153
|
-
<label class="govuk-label" for="input-width-3">
|
154
|
-
National insurance number
|
155
|
-
</label>
|
156
|
-
|
157
|
-
<span id="input-width-3-hint" class="govuk-hint">
|
158
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
159
|
-
</span>
|
160
|
-
|
161
|
-
<input class="govuk-input govuk-input--width-3" id="input-width-3" name="test-width-3" type="text" aria-describedby="input-width-3-hint">
|
162
|
-
</div>
|
163
|
-
|
164
|
-
#### Macro
|
165
|
-
|
166
|
-
{% from "input/macro.njk" import govukInput %}
|
167
|
-
|
168
|
-
{{ govukInput({
|
169
|
-
"label": {
|
170
|
-
"text": "National insurance number"
|
171
|
-
},
|
172
|
-
"hint": {
|
173
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
174
|
-
},
|
175
|
-
"id": "input-width-3",
|
176
|
-
"name": "test-width-3",
|
177
|
-
"classes": "govuk-input--width-3"
|
178
|
-
}) }}
|
179
|
-
|
180
|
-
### Input with width-4 class
|
181
|
-
|
182
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-4-class/preview)
|
183
|
-
|
184
|
-
#### Markup
|
185
|
-
|
186
|
-
<div class="govuk-form-group">
|
187
|
-
<label class="govuk-label" for="input-width-4">
|
188
|
-
National insurance number
|
189
|
-
</label>
|
190
|
-
|
191
|
-
<span id="input-width-4-hint" class="govuk-hint">
|
192
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
193
|
-
</span>
|
194
|
-
|
195
|
-
<input class="govuk-input govuk-input--width-4" id="input-width-4" name="test-width-4" type="text" aria-describedby="input-width-4-hint">
|
196
|
-
</div>
|
197
|
-
|
198
|
-
#### Macro
|
199
|
-
|
200
|
-
{% from "input/macro.njk" import govukInput %}
|
201
|
-
|
202
|
-
{{ govukInput({
|
203
|
-
"label": {
|
204
|
-
"text": "National insurance number"
|
205
|
-
},
|
206
|
-
"hint": {
|
207
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
208
|
-
},
|
209
|
-
"id": "input-width-4",
|
210
|
-
"name": "test-width-4",
|
211
|
-
"classes": "govuk-input--width-4"
|
212
|
-
}) }}
|
213
|
-
|
214
|
-
### Input with width-5 class
|
215
|
-
|
216
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-5-class/preview)
|
217
|
-
|
218
|
-
#### Markup
|
219
|
-
|
220
|
-
<div class="govuk-form-group">
|
221
|
-
<label class="govuk-label" for="input-width-5">
|
222
|
-
National insurance number
|
223
|
-
</label>
|
224
|
-
|
225
|
-
<span id="input-width-5-hint" class="govuk-hint">
|
226
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
227
|
-
</span>
|
228
|
-
|
229
|
-
<input class="govuk-input govuk-input--width-5" id="input-width-5" name="test-width-5" type="text" aria-describedby="input-width-5-hint">
|
230
|
-
</div>
|
231
|
-
|
232
|
-
#### Macro
|
233
|
-
|
234
|
-
{% from "input/macro.njk" import govukInput %}
|
235
|
-
|
236
|
-
{{ govukInput({
|
237
|
-
"label": {
|
238
|
-
"text": "National insurance number"
|
239
|
-
},
|
240
|
-
"hint": {
|
241
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
242
|
-
},
|
243
|
-
"id": "input-width-5",
|
244
|
-
"name": "test-width-5",
|
245
|
-
"classes": "govuk-input--width-5"
|
246
|
-
}) }}
|
247
|
-
|
248
|
-
### Input with width-10 class
|
249
|
-
|
250
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-10-class/preview)
|
251
|
-
|
252
|
-
#### Markup
|
253
|
-
|
254
|
-
<div class="govuk-form-group">
|
255
|
-
<label class="govuk-label" for="input-width-10">
|
256
|
-
National insurance number
|
257
|
-
</label>
|
258
|
-
|
259
|
-
<span id="input-width-10-hint" class="govuk-hint">
|
260
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
261
|
-
</span>
|
262
|
-
|
263
|
-
<input class="govuk-input govuk-input--width-10" id="input-width-10" name="test-width-10" type="text" aria-describedby="input-width-10-hint">
|
264
|
-
</div>
|
265
|
-
|
266
|
-
#### Macro
|
267
|
-
|
268
|
-
{% from "input/macro.njk" import govukInput %}
|
269
|
-
|
270
|
-
{{ govukInput({
|
271
|
-
"label": {
|
272
|
-
"text": "National insurance number"
|
273
|
-
},
|
274
|
-
"hint": {
|
275
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
276
|
-
},
|
277
|
-
"id": "input-width-10",
|
278
|
-
"name": "test-width-10",
|
279
|
-
"classes": "govuk-input--width-10"
|
280
|
-
}) }}
|
281
|
-
|
282
|
-
### Input with width-20 class
|
283
|
-
|
284
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-20-class/preview)
|
285
|
-
|
286
|
-
#### Markup
|
287
|
-
|
288
|
-
<div class="govuk-form-group">
|
289
|
-
<label class="govuk-label" for="input-width-20">
|
290
|
-
National insurance number
|
291
|
-
</label>
|
292
|
-
|
293
|
-
<span id="input-width-20-hint" class="govuk-hint">
|
294
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
295
|
-
</span>
|
296
|
-
|
297
|
-
<input class="govuk-input govuk-input--width-20" id="input-width-20" name="test-width-20" type="text" aria-describedby="input-width-20-hint">
|
298
|
-
</div>
|
299
|
-
|
300
|
-
#### Macro
|
301
|
-
|
302
|
-
{% from "input/macro.njk" import govukInput %}
|
303
|
-
|
304
|
-
{{ govukInput({
|
305
|
-
"label": {
|
306
|
-
"text": "National insurance number"
|
307
|
-
},
|
308
|
-
"hint": {
|
309
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
310
|
-
},
|
311
|
-
"id": "input-width-20",
|
312
|
-
"name": "test-width-20",
|
313
|
-
"classes": "govuk-input--width-20"
|
314
|
-
}) }}
|
315
|
-
|
316
|
-
### Input with width-30 class
|
317
|
-
|
318
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-width-30-class/preview)
|
319
|
-
|
320
|
-
#### Markup
|
321
|
-
|
322
|
-
<div class="govuk-form-group">
|
323
|
-
<label class="govuk-label" for="input-width-30">
|
324
|
-
National insurance number
|
325
|
-
</label>
|
326
|
-
|
327
|
-
<span id="input-width-30-hint" class="govuk-hint">
|
328
|
-
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
329
|
-
</span>
|
330
|
-
|
331
|
-
<input class="govuk-input govuk-input--width-30" id="input-width-30" name="test-width-30" type="text" aria-describedby="input-width-30-hint">
|
332
|
-
</div>
|
333
|
-
|
334
|
-
#### Macro
|
335
|
-
|
336
|
-
{% from "input/macro.njk" import govukInput %}
|
337
|
-
|
338
|
-
{{ govukInput({
|
339
|
-
"label": {
|
340
|
-
"text": "National insurance number"
|
341
|
-
},
|
342
|
-
"hint": {
|
343
|
-
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
344
|
-
},
|
345
|
-
"id": "input-width-30",
|
346
|
-
"name": "test-width-30",
|
347
|
-
"classes": "govuk-input--width-30"
|
348
|
-
}) }}
|
349
|
-
|
350
|
-
### Input with label as page heading
|
351
|
-
|
352
|
-
[Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/input/with-label-as-page-heading/preview)
|
353
|
-
|
354
|
-
#### Markup
|
355
|
-
|
356
|
-
<div class="govuk-form-group">
|
357
|
-
<h1 class="govuk-label-wrapper">
|
358
|
-
<label class="govuk-label" for="input-with-page-heading">
|
359
|
-
National Insurance number
|
360
|
-
</label>
|
361
|
-
|
362
|
-
</h1>
|
363
|
-
|
364
|
-
<input class="govuk-input" id="input-with-page-heading" name="test-name" type="text">
|
365
|
-
</div>
|
366
|
-
|
367
|
-
#### Macro
|
368
|
-
|
369
|
-
{% from "input/macro.njk" import govukInput %}
|
370
|
-
|
371
|
-
{{ govukInput({
|
372
|
-
"label": {
|
373
|
-
"text": "National Insurance number",
|
374
|
-
"isPageHeading": true
|
375
|
-
},
|
376
|
-
"id": "input-with-page-heading",
|
377
|
-
"name": "test-name"
|
378
|
-
}) }}
|
379
|
-
|
380
|
-
## Requirements
|
381
|
-
|
382
|
-
### Build tool configuration
|
383
|
-
|
384
|
-
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
385
|
-
|
386
|
-
.pipe(sass({
|
387
|
-
includePaths: 'node_modules/'
|
388
|
-
}))
|
389
|
-
|
390
|
-
### Static asset path configuration
|
391
|
-
|
392
|
-
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:
|
393
|
-
|
394
|
-
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
395
|
-
|
396
11
|
## Component options
|
397
12
|
|
398
13
|
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
|
399
14
|
|
400
|
-
See [options table](https://design-system.service.gov.uk/components/text-input/#options-example-default) for details.
|
401
|
-
|
402
|
-
### Setting up Nunjucks views and paths
|
403
|
-
|
404
|
-
Below is an example setup using express configure views:
|
405
|
-
|
406
|
-
nunjucks.configure('node_modules/govuk-frontend/components', {
|
407
|
-
autoescape: true,
|
408
|
-
cache: false,
|
409
|
-
express: app
|
410
|
-
})
|
411
|
-
|
412
|
-
## Contribution
|
413
|
-
|
414
|
-
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")
|
415
|
-
|
416
|
-
## License
|
417
|
-
|
418
|
-
MIT
|
15
|
+
See [options table](https://design-system.service.gov.uk/components/text-input/#options-example-default) for details.
|