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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -2
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +8 -0
  4. data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +8 -8
  5. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +10 -0
  6. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -14
  7. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +5 -3
  8. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +10 -6
  9. data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +3 -2
  10. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +71 -0
  11. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +18 -9
  12. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
  13. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +53 -0
  14. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +10 -5
  15. data/config/locales/en.yml +5 -6
  16. data/lib/govuk_publishing_components.rb +0 -2
  17. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -4
  18. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +108 -90
  19. data/lib/govuk_publishing_components/version.rb +1 -1
  20. data/node_modules/govuk-frontend/components/back-link/README.md +4 -73
  21. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +4 -238
  22. data/node_modules/govuk-frontend/components/button/README.md +4 -174
  23. data/node_modules/govuk-frontend/components/character-count/README.md +4 -340
  24. data/node_modules/govuk-frontend/components/character-count/template.njk +0 -3
  25. data/node_modules/govuk-frontend/components/checkboxes/README.md +4 -705
  26. data/node_modules/govuk-frontend/components/checkboxes/template.njk +1 -0
  27. data/node_modules/govuk-frontend/components/date-input/README.md +4 -563
  28. data/node_modules/govuk-frontend/components/date-input/template.njk +1 -0
  29. data/node_modules/govuk-frontend/components/details/README.md +4 -128
  30. data/node_modules/govuk-frontend/components/error-message/README.md +4 -58
  31. data/node_modules/govuk-frontend/components/error-summary/README.md +4 -94
  32. data/node_modules/govuk-frontend/components/fieldset/README.md +4 -92
  33. data/node_modules/govuk-frontend/components/file-upload/README.md +4 -199
  34. data/node_modules/govuk-frontend/components/file-upload/template.njk +1 -0
  35. data/node_modules/govuk-frontend/components/footer/README.md +4 -91
  36. data/node_modules/govuk-frontend/components/footer/_footer.scss +22 -13
  37. data/node_modules/govuk-frontend/components/header/README.md +4 -351
  38. data/node_modules/govuk-frontend/components/hint/README.md +5 -77
  39. data/node_modules/govuk-frontend/components/input/README.md +4 -407
  40. data/node_modules/govuk-frontend/components/input/template.njk +1 -0
  41. data/node_modules/govuk-frontend/components/inset-text/README.md +4 -76
  42. data/node_modules/govuk-frontend/components/label/README.md +5 -97
  43. data/node_modules/govuk-frontend/components/panel/README.md +4 -93
  44. data/node_modules/govuk-frontend/components/phase-banner/README.md +4 -67
  45. data/node_modules/govuk-frontend/components/radios/README.md +4 -665
  46. data/node_modules/govuk-frontend/components/radios/template.njk +1 -0
  47. data/node_modules/govuk-frontend/components/select/README.md +4 -257
  48. data/node_modules/govuk-frontend/components/select/template.njk +1 -0
  49. data/node_modules/govuk-frontend/components/skip-link/README.md +4 -57
  50. data/node_modules/govuk-frontend/components/table/README.md +4 -368
  51. data/node_modules/govuk-frontend/components/tabs/README.md +4 -242
  52. data/node_modules/govuk-frontend/components/tag/README.md +4 -77
  53. data/node_modules/govuk-frontend/components/textarea/README.md +4 -193
  54. data/node_modules/govuk-frontend/components/textarea/template.njk +1 -0
  55. data/node_modules/govuk-frontend/components/warning-text/README.md +4 -63
  56. data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +1 -2
  57. data/node_modules/govuk-frontend/core/_lists.scss +17 -8
  58. data/node_modules/govuk-frontend/package.json +10 -10
  59. metadata +4 -5
  60. data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +0 -116
  61. data/app/views/govuk_publishing_components/components/docs/taxonomy_navigation.yml +0 -119
  62. data/lib/govuk_publishing_components/presenters/taxonomy_navigation.rb +0 -47
@@ -31,6 +31,7 @@
31
31
  {{ govukErrorMessage({
32
32
  id: errorId,
33
33
  classes: params.errorMessage.classes,
34
+ attributes: params.errorMessage.attributes,
34
35
  html: params.errorMessage.html,
35
36
  text: params.errorMessage.text
36
37
  }) | indent(2) | trim }}
@@ -1,87 +1,15 @@
1
1
  # Inset text
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- Use bordered inset text to draw attention to important content on the page.
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 inset text component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/inset-text).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Inset text
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/inset-text/preview)
16
-
17
- #### Markup
18
-
19
- <div class="govuk-inset-text">
20
- It can take up to 8 weeks to register a lasting power of attorney if there are no mistakes in the application.
21
- </div>
22
-
23
- #### Macro
24
-
25
- {% from "inset-text/macro.njk" import govukInsetText %}
26
-
27
- {{ govukInsetText({
28
- "text": "It can take up to 8 weeks to register a lasting power of attorney if there are no mistakes in the application."
29
- }) }}
30
-
31
- ### Inset text with html
32
-
33
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/inset-text/with-html/preview)
34
-
35
- #### Markup
36
-
37
- <div class="govuk-inset-text">
38
- It can take up to 8 weeks to register a <a class="govuk-link" href="#">lasting power of attorney</a> if there are no mistakes in the application.
39
- </div>
40
-
41
- #### Macro
42
-
43
- {% from "inset-text/macro.njk" import govukInsetText %}
44
-
45
- {{ govukInsetText({
46
- "html": "It can take up to 8 weeks to register a <a class=\"govuk-link\" href=\"#\">lasting power of attorney</a> if there are no mistakes in the application."
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')))
64
-
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/inset-text/#options-example-default) 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/inset-text/#options-example-default) for details.
@@ -1,107 +1,15 @@
1
1
  # Label
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- Use labels for all form fields.
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
- ## Quick start examples
7
+ ## Guidance and Examples
8
8
 
9
- ### Label
10
-
11
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/label/preview)
12
-
13
- #### Markup
14
-
15
- <label class="govuk-label">
16
- National Insurance number
17
- </label>
18
-
19
- #### Macro
20
-
21
- {% from "label/macro.njk" import govukLabel %}
22
-
23
- {{ govukLabel({
24
- "text": "National Insurance number"
25
- }) }}
26
-
27
- ### Label with bold text
28
-
29
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/label/with-bold-text/preview)
30
-
31
- #### Markup
32
-
33
- <label class="govuk-label govuk-label--s">
34
- National Insurance number
35
- </label>
36
-
37
- #### Macro
38
-
39
- {% from "label/macro.njk" import govukLabel %}
40
-
41
- {{ govukLabel({
42
- "classes": "govuk-label--s",
43
- "text": "National Insurance number"
44
- }) }}
45
-
46
- ### Label as page heading
47
-
48
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/label/as-page-heading/preview)
49
-
50
- #### Markup
51
-
52
- <h1 class="govuk-label-wrapper">
53
- <label class="govuk-label govuk-label--xl">
54
- National Insurance number
55
- </label>
56
-
57
- </h1>
58
-
59
- #### Macro
60
-
61
- {% from "label/macro.njk" import govukLabel %}
62
-
63
- {{ govukLabel({
64
- "text": "National Insurance number",
65
- "classes": "govuk-label--xl",
66
- "isPageHeading": true
67
- }) }}
68
-
69
- ## Requirements
70
-
71
- ### Build tool configuration
72
-
73
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
74
-
75
- .pipe(sass({
76
- includePaths: 'node_modules/'
77
- }))
78
-
79
- ### Static asset path configuration
80
-
81
- 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:
82
-
83
- 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/).
84
10
 
85
11
  ## Component options
86
12
 
87
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
88
14
 
89
- See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default--label) for details.
90
-
91
- ### Setting up Nunjucks views and paths
92
-
93
- Below is an example setup using express configure views:
94
-
95
- nunjucks.configure('node_modules/govuk-frontend/components', {
96
- autoescape: true,
97
- cache: false,
98
- express: app
99
- })
100
-
101
- ## Contribution
102
-
103
- 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")
104
-
105
- ## License
106
-
107
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default--label) for details.
@@ -1,104 +1,15 @@
1
1
  # Panel
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- The confirmation panel has a turquoise background and white text. Used for transaction end pages, and Bank Holidays.
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 panel component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/panel).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Panel
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/panel/preview)
16
-
17
- #### Markup
18
-
19
- <div class="govuk-panel govuk-panel--confirmation">
20
- <h1 class="govuk-panel__title">
21
- Application complete
22
- </h1>
23
-
24
- <div class="govuk-panel__body">
25
- Your reference number: HDJ2123F
26
- </div>
27
-
28
- </div>
29
-
30
- #### Macro
31
-
32
- {% from "panel/macro.njk" import govukPanel %}
33
-
34
- {{ govukPanel({
35
- "titleHtml": "Application complete",
36
- "text": "Your reference number: HDJ2123F"
37
- }) }}
38
-
39
- ### Panel custom heading level
40
-
41
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/panel/custom-heading-level/preview)
42
-
43
- #### Markup
44
-
45
- <div class="govuk-panel govuk-panel--confirmation">
46
- <h2 class="govuk-panel__title">
47
- Application complete
48
- </h2>
49
-
50
- <div class="govuk-panel__body">
51
- Your reference number: HDJ2123F
52
- </div>
53
-
54
- </div>
55
-
56
- #### Macro
57
-
58
- {% from "panel/macro.njk" import govukPanel %}
59
-
60
- {{ govukPanel({
61
- "titleText": "Application complete",
62
- "headingLevel": 2,
63
- "text": "Your reference number: HDJ2123F"
64
- }) }}
65
-
66
- ## Requirements
67
-
68
- ### Build tool configuration
69
-
70
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
71
-
72
- .pipe(sass({
73
- includePaths: 'node_modules/'
74
- }))
75
-
76
- ### Static asset path configuration
77
-
78
- 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:
79
-
80
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
81
-
82
11
  ## Component options
83
12
 
84
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
85
14
 
86
- See [options table](https://design-system.service.gov.uk/components/panel/#options-example-default) for details.
87
-
88
- ### Setting up Nunjucks views and paths
89
-
90
- Below is an example setup using express configure views:
91
-
92
- nunjucks.configure('node_modules/govuk-frontend/components', {
93
- autoescape: true,
94
- cache: false,
95
- express: app
96
- })
97
-
98
- ## Contribution
99
-
100
- 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")
101
-
102
- ## License
103
-
104
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/panel/#options-example-default) for details.
@@ -1,78 +1,15 @@
1
1
  # Phase banner
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- A banner that indicates content is in alpha or beta phase with a description.
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 phase banner component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/phase-banner).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Phase banner
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/phase-banner/preview)
16
-
17
- #### Markup
18
-
19
- <div class="govuk-phase-banner">
20
- <p class="govuk-phase-banner__content"><strong class="govuk-tag govuk-phase-banner__content__tag ">
21
- alpha
22
- </strong>
23
- <span class="govuk-phase-banner__text">
24
- This is a new service - your <a href="#" class="govuk-link">feedback</a> will help us to improve it.
25
- </span>
26
- </p>
27
- </div>
28
-
29
- #### Macro
30
-
31
- {% from "phase-banner/macro.njk" import govukPhaseBanner %}
32
-
33
- {{ govukPhaseBanner({
34
- "tag": {
35
- "text": "alpha"
36
- },
37
- "html": "This is a new service - your <a href=\"#\" class=\"govuk-link\">feedback</a> will help us to improve it."
38
- }) }}
39
-
40
- ## Requirements
41
-
42
- ### Build tool configuration
43
-
44
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
45
-
46
- .pipe(sass({
47
- includePaths: 'node_modules/'
48
- }))
49
-
50
- ### Static asset path configuration
51
-
52
- 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:
53
-
54
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
55
-
56
11
  ## Component options
57
12
 
58
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
59
14
 
60
- See [options table](https://design-system.service.gov.uk/components/phase-banner/#options-example-default) for details.
61
-
62
- ### Setting up Nunjucks views and paths
63
-
64
- Below is an example setup using express configure views:
65
-
66
- nunjucks.configure('node_modules/govuk-frontend/components', {
67
- autoescape: true,
68
- cache: false,
69
- express: app
70
- })
71
-
72
- ## Contribution
73
-
74
- 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")
75
-
76
- ## License
77
-
78
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/phase-banner/#options-example-default) for details.
@@ -1,676 +1,15 @@
1
1
  # Radios
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- Let users select a single option from a list.
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 radios component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/radios).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Radios
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/preview)
16
-
17
- #### Markup
18
-
19
- <div class="govuk-form-group">
20
-
21
- <fieldset class="govuk-fieldset" aria-describedby="example-hint">
22
-
23
- <legend class="govuk-fieldset__legend">
24
- Have you changed your name?
25
- </legend>
26
-
27
- <span id="example-hint" class="govuk-hint">
28
- This includes changing your last name or spelling your name differently.
29
- </span>
30
-
31
- <div class="govuk-radios">
32
-
33
- <div class="govuk-radios__item">
34
- <input class="govuk-radios__input" id="example-1" name="example" type="radio" value="yes">
35
- <label class="govuk-label govuk-radios__label" for="example-1">
36
- Yes
37
- </label>
38
- </div>
39
-
40
- <div class="govuk-radios__item">
41
- <input class="govuk-radios__input" id="example-2" name="example" type="radio" value="no" checked>
42
- <label class="govuk-label govuk-radios__label" for="example-2">
43
- No
44
- </label>
45
- </div>
46
-
47
- </div>
48
- </fieldset>
49
-
50
- </div>
51
-
52
- #### Macro
53
-
54
- {% from "radios/macro.njk" import govukRadios %}
55
-
56
- {{ govukRadios({
57
- "idPrefix": "example",
58
- "name": "example",
59
- "fieldset": {
60
- "legend": {
61
- "text": "Have you changed your name?"
62
- }
63
- },
64
- "hint": {
65
- "text": "This includes changing your last name or spelling your name differently."
66
- },
67
- "items": [
68
- {
69
- "value": "yes",
70
- "text": "Yes"
71
- },
72
- {
73
- "value": "no",
74
- "text": "No",
75
- "checked": true
76
- }
77
- ]
78
- }) }}
79
-
80
- ### Radios inline
81
-
82
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/inline/preview)
83
-
84
- #### Markup
85
-
86
- <div class="govuk-form-group">
87
-
88
- <fieldset class="govuk-fieldset" aria-describedby="example&#39;-hint">
89
-
90
- <legend class="govuk-fieldset__legend">
91
- Have you changed your name?
92
- </legend>
93
-
94
- <span id="example&#39;-hint" class="govuk-hint">
95
- This includes changing your last name or spelling your name differently.
96
- </span>
97
-
98
- <div class="govuk-radios govuk-radios--inline">
99
-
100
- <div class="govuk-radios__item">
101
- <input class="govuk-radios__input" id="example&#39;-1" name="example" type="radio" value="yes">
102
- <label class="govuk-label govuk-radios__label" for="example&#39;-1">
103
- Yes
104
- </label>
105
- </div>
106
-
107
- <div class="govuk-radios__item">
108
- <input class="govuk-radios__input" id="example&#39;-2" name="example" type="radio" value="no" checked>
109
- <label class="govuk-label govuk-radios__label" for="example&#39;-2">
110
- No
111
- </label>
112
- </div>
113
-
114
- </div>
115
- </fieldset>
116
-
117
- </div>
118
-
119
- #### Macro
120
-
121
- {% from "radios/macro.njk" import govukRadios %}
122
-
123
- {{ govukRadios({
124
- "idPrefix": "example'",
125
- "classes": "govuk-radios--inline",
126
- "name": "example",
127
- "fieldset": {
128
- "legend": {
129
- "text": "Have you changed your name?"
130
- }
131
- },
132
- "hint": {
133
- "text": "This includes changing your last name or spelling your name differently."
134
- },
135
- "items": [
136
- {
137
- "value": "yes",
138
- "text": "Yes"
139
- },
140
- {
141
- "value": "no",
142
- "text": "No",
143
- "checked": true
144
- }
145
- ]
146
- }) }}
147
-
148
- ### Radios with disabled
149
-
150
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/with-disabled/preview)
151
-
152
- #### Markup
153
-
154
- <div class="govuk-form-group">
155
-
156
- <fieldset class="govuk-fieldset" aria-describedby="example-disabled-hint">
157
-
158
- <legend class="govuk-fieldset__legend">
159
- Have you changed your name?
160
- </legend>
161
-
162
- <span id="example-disabled-hint" class="govuk-hint">
163
- This includes changing your last name or spelling your name differently.
164
- </span>
165
-
166
- <div class="govuk-radios">
167
-
168
- <div class="govuk-radios__item">
169
- <input class="govuk-radios__input" id="example-disabled-1" name="example-disabled" type="radio" value="yes" disabled>
170
- <label class="govuk-label govuk-radios__label" for="example-disabled-1">
171
- Yes
172
- </label>
173
- </div>
174
-
175
- <div class="govuk-radios__item">
176
- <input class="govuk-radios__input" id="example-disabled-2" name="example-disabled" type="radio" value="no" disabled>
177
- <label class="govuk-label govuk-radios__label" for="example-disabled-2">
178
- No
179
- </label>
180
- </div>
181
-
182
- </div>
183
- </fieldset>
184
-
185
- </div>
186
-
187
- #### Macro
188
-
189
- {% from "radios/macro.njk" import govukRadios %}
190
-
191
- {{ govukRadios({
192
- "idPrefix": "example-disabled",
193
- "name": "example-disabled",
194
- "fieldset": {
195
- "legend": {
196
- "text": "Have you changed your name?"
197
- }
198
- },
199
- "hint": {
200
- "text": "This includes changing your last name or spelling your name differently."
201
- },
202
- "items": [
203
- {
204
- "value": "yes",
205
- "text": "Yes",
206
- "disabled": true
207
- },
208
- {
209
- "value": "no",
210
- "text": "No",
211
- "disabled": true
212
- }
213
- ]
214
- }) }}
215
-
216
- ### Radios with legend as page heading
217
-
218
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/with-legend-as-page-heading/preview)
219
-
220
- #### Markup
221
-
222
- <div class="govuk-form-group">
223
-
224
- <fieldset class="govuk-fieldset" aria-describedby="housing-act-hint">
225
-
226
- <legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
227
- <h1 class="govuk-fieldset__heading">
228
- Which part of the Housing Act was your licence issued under?
229
- </h1>
230
- </legend>
231
-
232
- <span id="housing-act-hint" class="govuk-hint">
233
- Select one of the options below.
234
- </span>
235
-
236
- <div class="govuk-radios">
237
-
238
- <div class="govuk-radios__item">
239
- <input class="govuk-radios__input" id="housing-act-1" name="housing-act" type="radio" value="part-2">
240
- <label class="govuk-label govuk-radios__label" for="housing-act-1">
241
- <span class="govuk-heading-s govuk-!-margin-bottom-1">Part 2 of the Housing Act 2004</span> For properties that are 3 or more stories high and occupied by 5 or more people
242
- </label>
243
- </div>
244
-
245
- <div class="govuk-radios__item">
246
- <input class="govuk-radios__input" id="housing-act-2" name="housing-act" type="radio" value="part-3">
247
- <label class="govuk-label govuk-radios__label" for="housing-act-2">
248
- <span class="govuk-heading-s govuk-!-margin-bottom-1">Part 3 of the Housing Act 2004</span> For properties that are within a geographical area defined by a local council
249
- </label>
250
- </div>
251
-
252
- </div>
253
- </fieldset>
254
-
255
- </div>
256
-
257
- #### Macro
258
-
259
- {% from "radios/macro.njk" import govukRadios %}
260
-
261
- {{ govukRadios({
262
- "idPrefix": "housing-act",
263
- "name": "housing-act",
264
- "fieldset": {
265
- "legend": {
266
- "text": "Which part of the Housing Act was your licence issued under?",
267
- "classes": "govuk-fieldset__legend--l",
268
- "isPageHeading": true
269
- }
270
- },
271
- "hint": {
272
- "text": "Select one of the options below."
273
- },
274
- "items": [
275
- {
276
- "value": "part-2",
277
- "html": "<span class=\"govuk-heading-s govuk-!-margin-bottom-1\">Part 2 of the Housing Act 2004</span> For properties that are 3 or more stories high and occupied by 5 or more people"
278
- },
279
- {
280
- "value": "part-3",
281
- "html": "<span class=\"govuk-heading-s govuk-!-margin-bottom-1\">Part 3 of the Housing Act 2004</span> For properties that are within a geographical area defined by a local council"
282
- }
283
- ]
284
- }) }}
285
-
286
- ### Radios with a medium legend
287
-
288
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/with-a-medium-legend/preview)
289
-
290
- #### Markup
291
-
292
- <div class="govuk-form-group">
293
-
294
- <fieldset class="govuk-fieldset" aria-describedby="housing-act-hint">
295
-
296
- <legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
297
- Which part of the Housing Act was your licence issued under?
298
- </legend>
299
-
300
- <span id="housing-act-hint" class="govuk-hint">
301
- Select one of the options below.
302
- </span>
303
-
304
- <div class="govuk-radios">
305
-
306
- <div class="govuk-radios__item">
307
- <input class="govuk-radios__input" id="housing-act-1" name="housing-act" type="radio" value="part-2">
308
- <label class="govuk-label govuk-radios__label" for="housing-act-1">
309
- <span class="govuk-heading-s govuk-!-margin-bottom-1">Part 2 of the Housing Act 2004</span> For properties that are 3 or more stories high and occupied by 5 or more people
310
- </label>
311
- </div>
312
-
313
- <div class="govuk-radios__item">
314
- <input class="govuk-radios__input" id="housing-act-2" name="housing-act" type="radio" value="part-3">
315
- <label class="govuk-label govuk-radios__label" for="housing-act-2">
316
- <span class="govuk-heading-s govuk-!-margin-bottom-1">Part 3 of the Housing Act 2004</span> For properties that are within a geographical area defined by a local council
317
- </label>
318
- </div>
319
-
320
- </div>
321
- </fieldset>
322
-
323
- </div>
324
-
325
- #### Macro
326
-
327
- {% from "radios/macro.njk" import govukRadios %}
328
-
329
- {{ govukRadios({
330
- "idPrefix": "housing-act",
331
- "name": "housing-act",
332
- "fieldset": {
333
- "legend": {
334
- "text": "Which part of the Housing Act was your licence issued under?",
335
- "classes": "govuk-fieldset__legend--m"
336
- }
337
- },
338
- "hint": {
339
- "text": "Select one of the options below."
340
- },
341
- "items": [
342
- {
343
- "value": "part-2",
344
- "html": "<span class=\"govuk-heading-s govuk-!-margin-bottom-1\">Part 2 of the Housing Act 2004</span> For properties that are 3 or more stories high and occupied by 5 or more people"
345
- },
346
- {
347
- "value": "part-3",
348
- "html": "<span class=\"govuk-heading-s govuk-!-margin-bottom-1\">Part 3 of the Housing Act 2004</span> For properties that are within a geographical area defined by a local council"
349
- }
350
- ]
351
- }) }}
352
-
353
- ### Radios with a divider
354
-
355
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/with-a-divider/preview)
356
-
357
- #### Markup
358
-
359
- <div class="govuk-form-group">
360
-
361
- <fieldset class="govuk-fieldset">
362
-
363
- <legend class="govuk-fieldset__legend">
364
- How do you want to sign in?
365
- </legend>
366
-
367
- <div class="govuk-radios">
368
-
369
- <div class="govuk-radios__item">
370
- <input class="govuk-radios__input" id="example-divider-1" name="example" type="radio" value="governement-gateway">
371
- <label class="govuk-label govuk-radios__label" for="example-divider-1">
372
- Use Government Gateway
373
- </label>
374
- </div>
375
-
376
- <div class="govuk-radios__item">
377
- <input class="govuk-radios__input" id="example-divider-2" name="example" type="radio" value="govuk-verify">
378
- <label class="govuk-label govuk-radios__label" for="example-divider-2">
379
- Use GOV.UK Verify
380
- </label>
381
- </div>
382
-
383
- <div class="govuk-radios__divider">or</div>
384
-
385
- <div class="govuk-radios__item">
386
- <input class="govuk-radios__input" id="example-divider-4" name="example" type="radio" value="create-account">
387
- <label class="govuk-label govuk-radios__label" for="example-divider-4">
388
- Create an account
389
- </label>
390
- </div>
391
-
392
- </div>
393
- </fieldset>
394
-
395
- </div>
396
-
397
- #### Macro
398
-
399
- {% from "radios/macro.njk" import govukRadios %}
400
-
401
- {{ govukRadios({
402
- "idPrefix": "example-divider",
403
- "name": "example",
404
- "fieldset": {
405
- "legend": {
406
- "text": "How do you want to sign in?"
407
- }
408
- },
409
- "items": [
410
- {
411
- "value": "governement-gateway",
412
- "text": "Use Government Gateway"
413
- },
414
- {
415
- "value": "govuk-verify",
416
- "text": "Use GOV.UK Verify"
417
- },
418
- {
419
- "divider": "or"
420
- },
421
- {
422
- "value": "create-account",
423
- "text": "Create an account"
424
- }
425
- ]
426
- }) }}
427
-
428
- ### Radios with hints on items
429
-
430
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/with-hints-on-items/preview)
431
-
432
- #### Markup
433
-
434
- <div class="govuk-form-group">
435
-
436
- <fieldset class="govuk-fieldset">
437
-
438
- <legend class="govuk-fieldset__legend">
439
- <h1 class="govuk-fieldset__heading">
440
- How do you want to sign in?
441
- </h1>
442
- </legend>
443
-
444
- <div class="govuk-radios">
445
-
446
- <div class="govuk-radios__item">
447
- <input class="govuk-radios__input" id="gov-1" name="gov" type="radio" value="gateway" aria-describedby="gov-1-item-hint">
448
- <label class="govuk-label govuk-radios__label" for="gov-1">
449
- Sign in with Government Gateway
450
- </label>
451
- <span id="gov-1-item-hint" class="govuk-hint govuk-radios__hint">
452
- You&#39;ll have a user ID if you&#39;ve registered for Self Assessment or filed a tax return online before.
453
- </span>
454
- </div>
455
-
456
- <div class="govuk-radios__item">
457
- <input class="govuk-radios__input" id="gov-2" name="gov" type="radio" value="verify" aria-describedby="gov-2-item-hint">
458
- <label class="govuk-label govuk-radios__label" for="gov-2">
459
- Sign in with GOV.UK Verify
460
- </label>
461
- <span id="gov-2-item-hint" class="govuk-hint govuk-radios__hint">
462
- You’ll have an account if you’ve already proved your identity with either Barclays, CitizenSafe, Digidentity, Experian, Post Office, Royal Mail or SecureIdentity.
463
- </span>
464
- </div>
465
-
466
- </div>
467
- </fieldset>
468
-
469
- </div>
470
-
471
- #### Macro
472
-
473
- {% from "radios/macro.njk" import govukRadios %}
474
-
475
- {{ govukRadios({
476
- "idPrefix": "gov",
477
- "name": "gov",
478
- "fieldset": {
479
- "legend": {
480
- "text": "How do you want to sign in?",
481
- "isPageHeading": true
482
- }
483
- },
484
- "items": [
485
- {
486
- "value": "gateway",
487
- "text": "Sign in with Government Gateway",
488
- "hint": {
489
- "text": "You'll have a user ID if you've registered for Self Assessment or filed a tax return online before."
490
- }
491
- },
492
- {
493
- "value": "verify",
494
- "text": "Sign in with GOV.UK Verify",
495
- "hint": {
496
- "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."
497
- }
498
- }
499
- ]
500
- }) }}
501
-
502
- ### Radios without fieldset
503
-
504
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/without-fieldset/preview)
505
-
506
- #### Markup
507
-
508
- <div class="govuk-form-group">
509
-
510
- <div class="govuk-radios">
511
-
512
- <div class="govuk-radios__item">
513
- <input class="govuk-radios__input" id="colours-1" name="colours" type="radio" value="red">
514
- <label class="govuk-label govuk-radios__label" for="colours-1">
515
- Red
516
- </label>
517
- </div>
518
-
519
- <div class="govuk-radios__item">
520
- <input class="govuk-radios__input" id="colours-2" name="colours" type="radio" value="green">
521
- <label class="govuk-label govuk-radios__label" for="colours-2">
522
- Green
523
- </label>
524
- </div>
525
-
526
- <div class="govuk-radios__item">
527
- <input class="govuk-radios__input" id="colours-3" name="colours" type="radio" value="blue">
528
- <label class="govuk-label govuk-radios__label" for="colours-3">
529
- Blue
530
- </label>
531
- </div>
532
-
533
- </div>
534
-
535
- </div>
536
-
537
- #### Macro
538
-
539
- {% from "radios/macro.njk" import govukRadios %}
540
-
541
- {{ govukRadios({
542
- "name": "colours",
543
- "items": [
544
- {
545
- "value": "red",
546
- "text": "Red"
547
- },
548
- {
549
- "value": "green",
550
- "text": "Green"
551
- },
552
- {
553
- "value": "blue",
554
- "text": "Blue"
555
- }
556
- ]
557
- }) }}
558
-
559
- ### Radios with all fieldset attributes
560
-
561
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/radios/with-all-fieldset-attributes/preview)
562
-
563
- #### Markup
564
-
565
- <div class="govuk-form-group govuk-form-group--error">
566
-
567
- <fieldset class="govuk-fieldset app-fieldset--custom-modifier" aria-describedby="example-hint example-error" data-attribute="value" data-second-attribute="second-value">
568
-
569
- <legend class="govuk-fieldset__legend">
570
- Have you changed your name?
571
- </legend>
572
-
573
- <span id="example-hint" class="govuk-hint">
574
- This includes changing your last name or spelling your name differently.
575
- </span>
576
-
577
- <span id="example-error" class="govuk-error-message">
578
- Please select an option
579
- </span>
580
-
581
- <div class="govuk-radios">
582
-
583
- <div class="govuk-radios__item">
584
- <input class="govuk-radios__input" id="example-1" name="example" type="radio" value="yes">
585
- <label class="govuk-label govuk-radios__label" for="example-1">
586
- Yes
587
- </label>
588
- </div>
589
-
590
- <div class="govuk-radios__item">
591
- <input class="govuk-radios__input" id="example-2" name="example" type="radio" value="no" checked>
592
- <label class="govuk-label govuk-radios__label" for="example-2">
593
- No
594
- </label>
595
- </div>
596
-
597
- </div>
598
- </fieldset>
599
-
600
- </div>
601
-
602
- #### Macro
603
-
604
- {% from "radios/macro.njk" import govukRadios %}
605
-
606
- {{ govukRadios({
607
- "idPrefix": "example",
608
- "name": "example",
609
- "errorMessage": {
610
- "text": "Please select an option"
611
- },
612
- "fieldset": {
613
- "classes": "app-fieldset--custom-modifier",
614
- "attributes": {
615
- "data-attribute": "value",
616
- "data-second-attribute": "second-value"
617
- },
618
- "legend": {
619
- "text": "Have you changed your name?"
620
- }
621
- },
622
- "hint": {
623
- "text": "This includes changing your last name or spelling your name differently."
624
- },
625
- "items": [
626
- {
627
- "value": "yes",
628
- "text": "Yes"
629
- },
630
- {
631
- "value": "no",
632
- "text": "No",
633
- "checked": true
634
- }
635
- ]
636
- }) }}
637
-
638
- ## Requirements
639
-
640
- ### Build tool configuration
641
-
642
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
643
-
644
- .pipe(sass({
645
- includePaths: 'node_modules/'
646
- }))
647
-
648
- ### Static asset path configuration
649
-
650
- 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:
651
-
652
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
653
-
654
11
  ## Component options
655
12
 
656
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
657
14
 
658
- See [options table](https://design-system.service.gov.uk/components/radios/#options-example-default) for details.
659
-
660
- ### Setting up Nunjucks views and paths
661
-
662
- Below is an example setup using express configure views:
663
-
664
- nunjucks.configure('node_modules/govuk-frontend/components', {
665
- autoescape: true,
666
- cache: false,
667
- express: app
668
- })
669
-
670
- ## Contribution
671
-
672
- 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")
673
-
674
- ## License
675
-
676
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/radios/#options-example-default) for details.