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.
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
@@ -45,6 +45,7 @@
45
45
  {{ govukErrorMessage({
46
46
  id: errorId,
47
47
  classes: params.errorMessage.classes,
48
+ attributes: params.errorMessage.attributes,
48
49
  html: params.errorMessage.html,
49
50
  text: params.errorMessage.text
50
51
  }) | indent(2) | trim }}
@@ -1,139 +1,15 @@
1
1
  # Details
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- Component for conditionally revealing content, using the details HTML element.
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 details component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/details).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Details
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/details/preview)
16
-
17
- #### Markup
18
-
19
- <details class="govuk-details">
20
- <summary class="govuk-details__summary">
21
- <span class="govuk-details__summary-text">
22
- Help with nationality
23
- </span>
24
- </summary>
25
- <div class="govuk-details__text">
26
- We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post.
27
- </div>
28
- </details>
29
-
30
- #### Macro
31
-
32
- {% from "details/macro.njk" import govukDetails %}
33
-
34
- {{ govukDetails({
35
- "summaryText": "Help with nationality",
36
- "text": "We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post."
37
- }) }}
38
-
39
- ### Details expanded
40
-
41
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/details/expanded/preview)
42
-
43
- #### Markup
44
-
45
- <details id="help-with-nationality" class="govuk-details" open>
46
- <summary class="govuk-details__summary">
47
- <span class="govuk-details__summary-text">
48
- Help with nationality
49
- </span>
50
- </summary>
51
- <div class="govuk-details__text">
52
- We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post.
53
- </div>
54
- </details>
55
-
56
- #### Macro
57
-
58
- {% from "details/macro.njk" import govukDetails %}
59
-
60
- {{ govukDetails({
61
- "id": "help-with-nationality",
62
- "summaryText": "Help with nationality",
63
- "text": "We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post.",
64
- "open": true
65
- }) }}
66
-
67
- ### Details with html
68
-
69
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/details/with-html/preview)
70
-
71
- #### Markup
72
-
73
- <details class="govuk-details">
74
- <summary class="govuk-details__summary">
75
- <span class="govuk-details__summary-text">
76
- Where to find your National Insurance Number
77
- </span>
78
- </summary>
79
- <div class="govuk-details__text">
80
- Your National Insurance number can be found on
81
- <ul>
82
- <li>your National Insurance card</li>
83
- <li>your payslip</li>
84
- <li>P60</li>
85
- <li>benefits information</li>
86
- <li>tax return</li>
87
- </ul>
88
-
89
- </div>
90
- </details>
91
-
92
- #### Macro
93
-
94
- {% from "details/macro.njk" import govukDetails %}
95
-
96
- {{ govukDetails({
97
- "summaryText": "Where to find your National Insurance Number",
98
- "html": "Your National Insurance number can be found on\n<ul>\n <li>your National Insurance card</li>\n <li>your payslip</li>\n <li>P60</li>\n <li>benefits information</li>\n <li>tax return</li>\n</ul>\n"
99
- }) }}
100
-
101
- ## Requirements
102
-
103
- ### Build tool configuration
104
-
105
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
106
-
107
- .pipe(sass({
108
- includePaths: 'node_modules/'
109
- }))
110
-
111
- ### Static asset path configuration
112
-
113
- 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:
114
-
115
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
116
-
117
11
  ## Component options
118
12
 
119
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
120
14
 
121
- See [options table](https://design-system.service.gov.uk/components/details/#options-example-default) for details.
122
-
123
- ### Setting up Nunjucks views and paths
124
-
125
- Below is an example setup using express configure views:
126
-
127
- nunjucks.configure('node_modules/govuk-frontend/components', {
128
- autoescape: true,
129
- cache: false,
130
- express: app
131
- })
132
-
133
- ## Contribution
134
-
135
- 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")
136
-
137
- ## License
138
-
139
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/details/#options-example-default) for details.
@@ -1,69 +1,15 @@
1
1
  # Error message
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- Component to show a red error message - used for form validation. Use inside a label or legend.
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 error message component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/error-message).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Error message
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/error-message/preview)
16
-
17
- #### Markup
18
-
19
- <span class="govuk-error-message">
20
- Error message about full name goes here
21
- </span>
22
-
23
- #### Macro
24
-
25
- {% from "error-message/macro.njk" import govukErrorMessage %}
26
-
27
- {{ govukErrorMessage({
28
- "text": "Error message about full name goes here"
29
- }) }}
30
-
31
- ## Requirements
32
-
33
- ### Build tool configuration
34
-
35
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
36
-
37
- .pipe(sass({
38
- includePaths: 'node_modules/'
39
- }))
40
-
41
- ### Static asset path configuration
42
-
43
- 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:
44
-
45
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
46
-
47
11
  ## Component options
48
12
 
49
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
50
14
 
51
- See [options table](https://design-system.service.gov.uk/components/error-message/#options-example-default) for details.
52
-
53
- ### Setting up Nunjucks views and paths
54
-
55
- Below is an example setup using express configure views:
56
-
57
- nunjucks.configure('node_modules/govuk-frontend/components', {
58
- autoescape: true,
59
- cache: false,
60
- express: app
61
- })
62
-
63
- ## Contribution
64
-
65
- 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")
66
-
67
- ## License
68
-
69
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/error-message/#options-example-default) for details.
@@ -1,105 +1,15 @@
1
1
  # Error summary
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- Component to show an error summary box - used at the top of the page, to summarise validation errors.
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 error summary component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/error-summary).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Error summary
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/error-summary/preview)
16
-
17
- #### Markup
18
-
19
- <div class="govuk-error-summary optional-extra-class" aria-labelledby="error-summary-title" role="alert" tabindex="-1" data-module="error-summary">
20
- <h2 class="govuk-error-summary__title" id="error-summary-title">
21
- Message to alert the user to a problem goes here
22
- </h2>
23
- <div class="govuk-error-summary__body">
24
-
25
- <p>
26
- Optional description of the errors and how to correct them
27
- </p>
28
-
29
- <ul class="govuk-list govuk-error-summary__list">
30
-
31
- <li>
32
-
33
- <a href="#example-error-1">Descriptive link to the question with an error</a>
34
-
35
- </li>
36
-
37
- <li>
38
-
39
- <a href="#example-error-1">Descriptive link to the question with an error</a>
40
-
41
- </li>
42
-
43
- </ul>
44
- </div>
45
- </div>
46
-
47
- #### Macro
48
-
49
- {% from "error-summary/macro.njk" import govukErrorSummary %}
50
-
51
- {{ govukErrorSummary({
52
- "titleText": "Message to alert the user to a problem goes here",
53
- "descriptionText": "Optional description of the errors and how to correct them",
54
- "classes": "optional-extra-class",
55
- "errorList": [
56
- {
57
- "text": "Descriptive link to the question with an error",
58
- "href": "#example-error-1"
59
- },
60
- {
61
- "text": "Descriptive link to the question with an error",
62
- "href": "#example-error-1"
63
- }
64
- ]
65
- }) }}
66
-
67
- ## Requirements
68
-
69
- ### Build tool configuration
70
-
71
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
72
-
73
- .pipe(sass({
74
- includePaths: 'node_modules/'
75
- }))
76
-
77
- ### Static asset path configuration
78
-
79
- 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:
80
-
81
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
82
-
83
11
  ## Component options
84
12
 
85
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
86
14
 
87
- See [options table](https://design-system.service.gov.uk/components/error-summary/#options-example-default) for details.
88
-
89
- ### Setting up Nunjucks views and paths
90
-
91
- Below is an example setup using express configure views:
92
-
93
- nunjucks.configure('node_modules/govuk-frontend/components', {
94
- autoescape: true,
95
- cache: false,
96
- express: app
97
- })
98
-
99
- ## Contribution
100
-
101
- 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")
102
-
103
- ## License
104
-
105
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/error-summary/#options-example-default) for details.
@@ -1,103 +1,15 @@
1
1
  # Fieldset
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- The fieldset element is used to group several controls within a web form. The legend element represents a caption for the content of its parent fieldset.
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 fieldset component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/fieldset).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Fieldset
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/fieldset/preview)
16
-
17
- #### Markup
18
-
19
- <fieldset class="govuk-fieldset">
20
-
21
- <legend class="govuk-fieldset__legend">
22
- What is your address?
23
- </legend>
24
-
25
- </fieldset>
26
-
27
- #### Macro
28
-
29
- {% from "fieldset/macro.njk" import govukFieldset %}
30
-
31
- {{ govukFieldset({
32
- "legend": {
33
- "text": "What is your address?"
34
- }
35
- }) }}
36
-
37
- ### Fieldset as page heading
38
-
39
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/fieldset/as-page-heading/preview)
40
-
41
- #### Markup
42
-
43
- <fieldset class="govuk-fieldset">
44
-
45
- <legend class="govuk-fieldset__legend govuk-fieldset__legend--xl">
46
- <h1 class="govuk-fieldset__heading">
47
- What is your address?
48
- </h1>
49
- </legend>
50
-
51
- </fieldset>
52
-
53
- #### Macro
54
-
55
- {% from "fieldset/macro.njk" import govukFieldset %}
56
-
57
- {{ govukFieldset({
58
- "legend": {
59
- "text": "What is your address?",
60
- "classes": "govuk-fieldset__legend--xl",
61
- "isPageHeading": true
62
- }
63
- }) }}
64
-
65
- ## Requirements
66
-
67
- ### Build tool configuration
68
-
69
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
70
-
71
- .pipe(sass({
72
- includePaths: 'node_modules/'
73
- }))
74
-
75
- ### Static asset path configuration
76
-
77
- 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:
78
-
79
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
80
-
81
11
  ## Component options
82
12
 
83
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
84
14
 
85
- See [options table](https://design-system.service.gov.uk/components/fieldset/#options-example-default) for details.
86
-
87
- ### Setting up Nunjucks views and paths
88
-
89
- Below is an example setup using express configure views:
90
-
91
- nunjucks.configure('node_modules/govuk-frontend/components', {
92
- autoescape: true,
93
- cache: false,
94
- express: app
95
- })
96
-
97
- ## Contribution
98
-
99
- 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")
100
-
101
- ## License
102
-
103
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/fieldset/#options-example-default) for details.
@@ -1,210 +1,15 @@
1
1
  # File upload
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- The HTML `<input>` element with type="file" lets a user pick one or more files, to upload to a server.
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 file upload component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/file-upload).
10
10
 
11
- ## Quick start examples
12
-
13
- ### File upload
14
-
15
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/file-upload/preview)
16
-
17
- #### Markup
18
-
19
- <div class="govuk-form-group">
20
- <label class="govuk-label" for="file-upload-1">
21
- Upload a file
22
- </label>
23
-
24
- <input class="govuk-file-upload" id="file-upload-1" name="file-upload-1" type="file">
25
- </div>
26
-
27
- #### Macro
28
-
29
- {% from "file-upload/macro.njk" import govukFileUpload %}
30
-
31
- {{ govukFileUpload({
32
- "id": "file-upload-1",
33
- "name": "file-upload-1",
34
- "label": {
35
- "text": "Upload a file"
36
- }
37
- }) }}
38
-
39
- ### File upload with hint text
40
-
41
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-hint-text/preview)
42
-
43
- #### Markup
44
-
45
- <div class="govuk-form-group">
46
- <label class="govuk-label" for="file-upload-2">
47
- Upload your photo
48
- </label>
49
-
50
- <span id="file-upload-2-hint" class="govuk-hint">
51
- Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.
52
- </span>
53
-
54
- <input class="govuk-file-upload" id="file-upload-2" name="file-upload-2" type="file" aria-describedby="file-upload-2-hint">
55
- </div>
56
-
57
- #### Macro
58
-
59
- {% from "file-upload/macro.njk" import govukFileUpload %}
60
-
61
- {{ govukFileUpload({
62
- "id": "file-upload-2",
63
- "name": "file-upload-2",
64
- "label": {
65
- "text": "Upload your photo"
66
- },
67
- "hint": {
68
- "text": "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
69
- }
70
- }) }}
71
-
72
- ### File upload with error message
73
-
74
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-error-message/preview)
75
-
76
- #### Markup
77
-
78
- <div class="govuk-form-group govuk-form-group--error">
79
- <label class="govuk-label" for="file-upload-3">
80
- Upload a file
81
- </label>
82
-
83
- <span id="file-upload-3-hint" class="govuk-hint">
84
- Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.
85
- </span>
86
-
87
- <span id="file-upload-3-error" class="govuk-error-message">
88
- Error message goes here
89
- </span>
90
-
91
- <input class="govuk-file-upload govuk-file-upload--error" id="file-upload-3" name="file-upload-3" type="file" aria-describedby="file-upload-3-hint file-upload-3-error">
92
- </div>
93
-
94
- #### Macro
95
-
96
- {% from "file-upload/macro.njk" import govukFileUpload %}
97
-
98
- {{ govukFileUpload({
99
- "id": "file-upload-3",
100
- "name": "file-upload-3",
101
- "label": {
102
- "text": "Upload a file"
103
- },
104
- "hint": {
105
- "text": "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
106
- },
107
- "errorMessage": {
108
- "text": "Error message goes here"
109
- }
110
- }) }}
111
-
112
- ### File upload with value and attributes
113
-
114
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-value-and-attributes/preview)
115
-
116
- #### Markup
117
-
118
- <div class="govuk-form-group">
119
- <label class="govuk-label" for="file-upload-4">
120
- Upload a photo
121
- </label>
122
-
123
- <input class="govuk-file-upload" id="file-upload-4" name="file-upload-4" type="file" value="C:\fakepath\myphoto.jpg" accept=".jpg, .jpeg, .png">
124
- </div>
125
-
126
- #### Macro
127
-
128
- {% from "file-upload/macro.njk" import govukFileUpload %}
129
-
130
- {{ govukFileUpload({
131
- "id": "file-upload-4",
132
- "name": "file-upload-4",
133
- "value": "C:\\fakepath\\myphoto.jpg",
134
- "label": {
135
- "text": "Upload a photo"
136
- },
137
- "attributes": {
138
- "accept": ".jpg, .jpeg, .png"
139
- }
140
- }) }}
141
-
142
- ### File upload with label as page heading
143
-
144
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-label-as-page-heading/preview)
145
-
146
- #### Markup
147
-
148
- <div class="govuk-form-group">
149
- <h1 class="govuk-label-wrapper">
150
- <label class="govuk-label" for="file-upload-1">
151
- Upload a file
152
- </label>
153
-
154
- </h1>
155
-
156
- <input class="govuk-file-upload" id="file-upload-1" name="file-upload-1" type="file">
157
- </div>
158
-
159
- #### Macro
160
-
161
- {% from "file-upload/macro.njk" import govukFileUpload %}
162
-
163
- {{ govukFileUpload({
164
- "id": "file-upload-1",
165
- "name": "file-upload-1",
166
- "label": {
167
- "text": "Upload a file",
168
- "isPageHeading": true
169
- }
170
- }) }}
171
-
172
- ## Requirements
173
-
174
- ### Build tool configuration
175
-
176
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
177
-
178
- .pipe(sass({
179
- includePaths: 'node_modules/'
180
- }))
181
-
182
- ### Static asset path configuration
183
-
184
- 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:
185
-
186
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
187
-
188
11
  ## Component options
189
12
 
190
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
191
14
 
192
- See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default) for details.
193
-
194
- ### Setting up Nunjucks views and paths
195
-
196
- Below is an example setup using express configure views:
197
-
198
- nunjucks.configure('node_modules/govuk-frontend/components', {
199
- autoescape: true,
200
- cache: false,
201
- express: app
202
- })
203
-
204
- ## Contribution
205
-
206
- 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")
207
-
208
- ## License
209
-
210
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/file-upload/#options-example-default) for details.