-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html.md.erb
373 lines (235 loc) · 7.54 KB
/
index.html.md.erb
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
---
title: JavaScript API Reference
weight: 80
---
# JavaScript API Reference
Some of our components can be passed JavaScript configuration objects. You can do it both:
- [when configuring instances of specific components](../configure-components/#configure-instances-of-specific-components-using-the-createall-function)
- [when configuring all components using the `initAll` function](../configure-components/#configure-all-components-using-the-initall-function)
This page lists the options available for the following components:
- [Accordion](#accordion)
- [Button](#button)
- [CharacterCount](#charactercount)
- [ErrorSummary](#errorsummary)
- [ExitThisPage](#exitthispage)
- [NotificationBanner](#notificationbanner)
## Accordion
### i18n
Type: object
Messages used by the component for the labels of its buttons. This includes the
visible text shown on screen, and text to help assistive technology users for
the buttons toggling each section.
Default: see properties
#### Properties
##### hideAllSections
Type: string
The text content for the 'Hide all sections' button, used when at least one
section is expanded.
Default:
```javascript
'Hide all sections'
```
##### hideSection
Type: string
The text content for the 'Hide' button, used when a section is expanded.
Default:
```javascript
'Hide'
```
##### hideSectionAriaLabel
Type: string
The text content appended to the 'Hide' button's accessible name when a section is expanded.
Default:
```javascript
'Hide this section'
```
##### showAllSections
Type: string
The text content for the 'Show all sections' button, used when all sections are collapsed.
Default:
```javascript
'Show all sections'
```
##### showSection
Type: string
The text content for the 'Show' button, used when a section is collapsed.
Default:
```javascript
'Show'
```
##### showSectionAriaLabel
Type: string
The text content appended to the 'Show' button's accessible name when a section is expanded.
Default:
```javascript
'Show this section'
```
## Button
### preventDoubleClick
Type: boolean
Prevent accidental double clicks on submit buttons from submitting forms multiple times.
Default:
```javascript
false
```
## CharacterCount
### maxlength
Type: number
The maximum number of characters. If `maxwords` is provided, the `maxlength` option will be ignored.
### maxwords
Type: number
The maximum number of words. If `maxwords` is provided, the `maxlength` option will be ignored.
### threshold
Type: number
The percentage value of the limit at which point the count message is displayed. If this attribute is set, the count message will be hidden by default.
Default:
```javascript
0
```
### i18n
Type: object
Messages shown to users as they type. It provides feedback on how many words or
characters they have remaining or if they are over the limit. This also includes
a message used as an accessible description for the textarea.
Default: see properties
#### Properties
##### charactersUnderLimit
Type: object
Message displayed when the number of characters is under the configured maximum,
`maxlength`. This message is displayed visually and through assistive
technologies. The component will replace the `%{count}` placeholder with the
number of remaining characters. This is a [pluralised list of
messages](../localise-govuk-frontend/#understanding-pluralisation-rules).
Default:
```javascript
{
one: 'You have %{count} character remaining',
other: 'You have %{count} characters remaining'
}
```
##### charactersAtLimit
Type: object
Message displayed when the number of characters reaches the configured maximum,
`maxlength`. This message is displayed visually and through assistive
technologies.
Default:
```javascript
'You have 0 characters remaining'
```
##### charactersOverLimit
Type: object
Message displayed when the number of characters is over the configured maximum,
`maxlength`. This message is displayed visually and through assistive
technologies. The component will replace the `%{count}` placeholder with the
number of remaining characters. This is a [pluralised list of
messages](../localise-govuk-frontend/#understanding-pluralisation-rules).
Default:
```javascript
{
one: 'You have %{count} character too many',
other: 'You have %{count} characters too many'
}
```
##### wordsUnderLimit
Type: object
Message displayed when the number of words is under the configured maximum,
`maxwords`. This message is displayed visually and through assistive
technologies. The component will replace the `%{count}` placeholder with the
number of remaining words. This is a [pluralised list of
messages](../localise-govuk-frontend/#understanding-pluralisation-rules).
Default:
```javascript
{
one: 'You have %{count} word remaining',
other: 'You have %{count} words remaining'
}
```
##### wordsAtLimit
Type: object
Message displayed when the number of words reaches the configured maximum,
`maxwords`. This message is displayed visually and through assistive
technologies.
Default:
```javascript
'You have 0 words remaining'
```
##### wordsOverLimit
Type: object
Message displayed when the number of words is over the configured maximum,
`maxwords`. This message is displayed visually and through assistive
technologies. The component will replace the `%{count}` placeholder with the
number of remaining words. This is a [pluralised list of
messages](../localise-govuk-frontend/#understanding-pluralisation-rules).
Default:
```javascript
{
one: 'You have %{count} word too many',
other: 'You have %{count} words too many'
}
```
##### textareaDescription
Type: object
Message made available to assistive technologies, if none is already present in the HTML, to describe that the component accepts only a limited amount of content. The component will replace the `%{count}` placeholder with the value of the `maxlength` or `maxwords` parameter.
Default:
```javascript
{
other: ''
}
```
## ErrorSummary
### disableAutoFocus
If set to `true` the error summary will not be focussed when the page loads.
Type: boolean
Default
```javascript
false
```
## ExitThisPage
### i18n
Type: object
Messages used by the component for screen reader announcements relating to the
keyboard shortcut functionality, informing assistive technology users of the
current state of the shortcut.
All of these strings should be short and in plain text.
Default: see properties
#### Properties
##### activated
Type: string
Text to announce when the Exit This Page keyboard shortcut has been activated
and the user is being directed away from the current page.
Default:
```javascript
'Loading.'
```
##### pressOneMoreTime
Type: string
Text to announce when the user has pressed the activation key (Shift) twice, and
must press it one more time to activate the functionality.
Default:
```javascript
'Shift, press 1 more time to exit.'
```
##### pressTwoMoreTimes
Type: string
Text to announce when the user has pressed the activation key (Shift) once, and
must press it two more times to activate the functionality.
Default:
```javascript
'Shift, press 2 more times to exit.'
```
##### timedOut
Type: string
Text to announce if the user hasn't completed the keyboard shortcut within the
allowed time, so that the user is aware that they must begin the sequence again.
Default:
```javascript
'Exit this page expired.'
```
## NotificationBanner
### disableAutoFocus
Type: boolean
If set to `true` the notification banner will not be focussed when the page loads. This only applies if the component has a `role` of `alert` – in other cases the component will not be focused on page load, regardless of this option.
Default:
```javascript
false
```