govuk_publishing_components 9.3.6 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/assets/stylesheets/component_guide/application.scss +10 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/admin_styles.scss +13 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +66 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -0
- data/app/models/govuk_publishing_components/component_doc.rb +12 -0
- data/app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb +7 -5
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +22 -0
- data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +39 -0
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +26 -0
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +10 -0
- data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +142 -0
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +12 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +28 -0
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -0
- data/app/views/layouts/govuk_publishing_components/application.html.erb +5 -0
- data/config/initializers/assets.rb +12 -0
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +13 -0
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/README.md +96 -0
- data/node_modules/govuk-frontend/all-ie8.scss +6 -0
- data/node_modules/govuk-frontend/all.js +1720 -0
- data/node_modules/govuk-frontend/all.scss +11 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
- data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
- data/node_modules/govuk-frontend/common.js +39 -0
- data/node_modules/govuk-frontend/components/_all.scss +26 -0
- data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
- data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
- data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
- data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
- data/node_modules/govuk-frontend/components/button/README.md +319 -0
- data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
- data/node_modules/govuk-frontend/components/button/button.js +548 -0
- data/node_modules/govuk-frontend/components/button/button.njk +3 -0
- data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/button/template.njk +35 -0
- data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
- data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
- data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
- data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
- data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
- data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
- data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
- data/node_modules/govuk-frontend/components/details/README.md +237 -0
- data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
- data/node_modules/govuk-frontend/components/details/details.js +836 -0
- data/node_modules/govuk-frontend/components/details/details.njk +7 -0
- data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
- data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/details/template.njk +10 -0
- data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
- data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
- data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
- data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
- data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
- data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
- data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
- data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
- data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
- data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
- data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
- data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
- data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
- data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
- data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
- data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
- data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
- data/node_modules/govuk-frontend/components/footer/README.md +284 -0
- data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
- data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
- data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
- data/node_modules/govuk-frontend/components/header/README.md +524 -0
- data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
- data/node_modules/govuk-frontend/components/header/header.js +717 -0
- data/node_modules/govuk-frontend/components/header/header.njk +3 -0
- data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/header/template.njk +82 -0
- data/node_modules/govuk-frontend/components/hint/README.md +157 -0
- data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
- data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
- data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
- data/node_modules/govuk-frontend/components/input/README.md +416 -0
- data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
- data/node_modules/govuk-frontend/components/input/input.njk +9 -0
- data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/input/template.njk +42 -0
- data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
- data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
- data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
- data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
- data/node_modules/govuk-frontend/components/label/README.md +193 -0
- data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
- data/node_modules/govuk-frontend/components/label/label.njk +6 -0
- data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/label/template.njk +15 -0
- data/node_modules/govuk-frontend/components/panel/README.md +151 -0
- data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
- data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
- data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
- data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
- data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
- data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
- data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
- data/node_modules/govuk-frontend/components/radios/README.md +686 -0
- data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
- data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
- data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
- data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
- data/node_modules/govuk-frontend/components/select/README.md +387 -0
- data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
- data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/select/select.njk +24 -0
- data/node_modules/govuk-frontend/components/select/template.njk +44 -0
- data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
- data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
- data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
- data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
- data/node_modules/govuk-frontend/components/table/README.md +585 -0
- data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
- data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/table/table.njk +45 -0
- data/node_modules/govuk-frontend/components/table/template.njk +39 -0
- data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
- data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
- data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
- data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
- data/node_modules/govuk-frontend/components/tag/README.md +150 -0
- data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
- data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
- data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
- data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
- data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
- data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
- data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
- data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
- data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
- data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
- data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
- data/node_modules/govuk-frontend/core/_all.scss +6 -0
- data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
- data/node_modules/govuk-frontend/core/_links.scss +40 -0
- data/node_modules/govuk-frontend/core/_lists.scss +63 -0
- data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
- data/node_modules/govuk-frontend/core/_template.scss +16 -0
- data/node_modules/govuk-frontend/core/_typography.scss +186 -0
- data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
- data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
- data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
- data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
- data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
- data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
- data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
- data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
- data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
- data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
- data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
- data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
- data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
- data/node_modules/govuk-frontend/objects/_all.scss +4 -0
- data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
- data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
- data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
- data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
- data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
- data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
- data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
- data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
- data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
- data/node_modules/govuk-frontend/package.json +89 -0
- data/node_modules/govuk-frontend/settings/_all.scss +21 -0
- data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
- data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
- data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
- data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
- data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
- data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
- data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
- data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
- data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
- data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
- data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
- data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
- data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
- data/node_modules/govuk-frontend/template.njk +56 -0
- data/node_modules/govuk-frontend/tools/_all.scss +7 -0
- data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
- data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
- data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
- data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
- data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
- data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
- data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
- data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
- data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
- data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
- data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
- data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
- metadata +249 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
{# Determine type of element to use, if not explicitly set -#}
|
2
|
+
|
3
|
+
{% if params.element %}
|
4
|
+
{% set element = params.element | lower %}
|
5
|
+
{% else %}
|
6
|
+
{% if params.href %}
|
7
|
+
{% set element = 'a' %}
|
8
|
+
{% else %}
|
9
|
+
{% set element = 'button' %}
|
10
|
+
{% endif %}
|
11
|
+
{% endif %}
|
12
|
+
|
13
|
+
{#- Define common attributes that we can use across all element types #}
|
14
|
+
|
15
|
+
{%- set commonAttributes %} class="govuk-button{% if params.classes %} {{ params.classes }}{% endif %}{% if params.disabled %} govuk-button--disabled{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}{% endset %}
|
16
|
+
|
17
|
+
{#- Define common attributes we can use for both button and input types #}
|
18
|
+
|
19
|
+
{%- set buttonAttributes %}{% if params.name %} name="{{ params.name }}"{% endif %} type="{{ params.type if params.type else 'submit' }}"{% if params.disabled %} disabled="disabled" aria-disabled="true"{% endif %}{% endset %}
|
20
|
+
|
21
|
+
{#- Actually create a button... or a link! #}
|
22
|
+
|
23
|
+
{%- if element == 'a' %}
|
24
|
+
<a href="{{ params.href if params.href else '#' }}" role="button" {{- commonAttributes | safe }}>
|
25
|
+
{{ params.html | safe if params.html else params.text }}
|
26
|
+
</a>
|
27
|
+
|
28
|
+
{%- elseif element == 'button' %}
|
29
|
+
<button {%- if params.value %} value="{{ params.value }}"{% endif %} {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
|
30
|
+
{{ params.html | safe if params.html else params.text }}
|
31
|
+
</button>
|
32
|
+
|
33
|
+
{%- elseif element == 'input' %}
|
34
|
+
<input value="{{ params.text }}" {{- buttonAttributes | safe }} {{- commonAttributes | safe }}>
|
35
|
+
{%- endif %}
|
@@ -0,0 +1,782 @@
|
|
1
|
+
# Checkboxes
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Let users select one or more options.
|
6
|
+
|
7
|
+
## Guidance
|
8
|
+
|
9
|
+
Find out when to use the Checkboxes component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/checkboxes).
|
10
|
+
|
11
|
+
## Quick start examples
|
12
|
+
|
13
|
+
### Component default
|
14
|
+
|
15
|
+
[Preview the checkboxes component](http://govuk-frontend-review.herokuapp.com/components/checkboxes/preview)
|
16
|
+
|
17
|
+
#### Markup
|
18
|
+
|
19
|
+
<div class="govuk-form-group">
|
20
|
+
|
21
|
+
<fieldset class="govuk-fieldset" aria-describedby="nationality-hint">
|
22
|
+
|
23
|
+
<legend class="govuk-fieldset__legend">
|
24
|
+
What is your nationality?
|
25
|
+
</legend>
|
26
|
+
|
27
|
+
<span id="nationality-hint" class="govuk-hint">
|
28
|
+
If you have dual nationality, select all options that are relevant to you.
|
29
|
+
</span>
|
30
|
+
|
31
|
+
<div class="govuk-checkboxes">
|
32
|
+
|
33
|
+
<div class="govuk-checkboxes__item">
|
34
|
+
<input class="govuk-checkboxes__input" id="nationality-1" name="nationality" type="checkbox" value="british">
|
35
|
+
<label class="govuk-label govuk-checkboxes__label" for="nationality-1">
|
36
|
+
British
|
37
|
+
</label>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="govuk-checkboxes__item">
|
41
|
+
<input class="govuk-checkboxes__input" id="nationality-2" name="nationality" type="checkbox" value="irish">
|
42
|
+
<label class="govuk-label govuk-checkboxes__label" for="nationality-2">
|
43
|
+
Irish
|
44
|
+
</label>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="govuk-checkboxes__item">
|
48
|
+
<input class="govuk-checkboxes__input" id="nationality-3" name="nationality" type="checkbox" value="other">
|
49
|
+
<label class="govuk-label govuk-checkboxes__label" for="nationality-3">
|
50
|
+
Citizen of another country
|
51
|
+
</label>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
</fieldset>
|
56
|
+
|
57
|
+
</div>
|
58
|
+
|
59
|
+
#### Macro
|
60
|
+
|
61
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
62
|
+
|
63
|
+
{{ govukCheckboxes({
|
64
|
+
"idPrefix": "nationality",
|
65
|
+
"name": "nationality",
|
66
|
+
"fieldset": {
|
67
|
+
"legend": {
|
68
|
+
"text": "What is your nationality?"
|
69
|
+
}
|
70
|
+
},
|
71
|
+
"hint": {
|
72
|
+
"text": "If you have dual nationality, select all options that are relevant to you."
|
73
|
+
},
|
74
|
+
"items": [
|
75
|
+
{
|
76
|
+
"value": "british",
|
77
|
+
"text": "British"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"value": "irish",
|
81
|
+
"text": "Irish"
|
82
|
+
},
|
83
|
+
{
|
84
|
+
"value": "other",
|
85
|
+
"text": "Citizen of another country"
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}) }}
|
89
|
+
|
90
|
+
### Checkboxes--with-id-plus-name
|
91
|
+
|
92
|
+
[Preview the checkboxes--with-id-plus-name example](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-id-plus-name/preview)
|
93
|
+
|
94
|
+
#### Markup
|
95
|
+
|
96
|
+
<div class="govuk-form-group">
|
97
|
+
|
98
|
+
<fieldset class="govuk-fieldset" aria-describedby="undefined-hint">
|
99
|
+
|
100
|
+
<legend class="govuk-fieldset__legend">
|
101
|
+
What is your nationality?
|
102
|
+
</legend>
|
103
|
+
|
104
|
+
<span id="undefined-hint" class="govuk-hint">
|
105
|
+
If you have dual nationality, select all options that are relevant to you.
|
106
|
+
</span>
|
107
|
+
|
108
|
+
<div class="govuk-checkboxes">
|
109
|
+
|
110
|
+
<div class="govuk-checkboxes__item">
|
111
|
+
<input class="govuk-checkboxes__input" id="item_british" name="british" type="checkbox" value="yes">
|
112
|
+
<label class="govuk-label govuk-checkboxes__label" for="item_british">
|
113
|
+
British
|
114
|
+
</label>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
<div class="govuk-checkboxes__item">
|
118
|
+
<input class="govuk-checkboxes__input" id="item_irish" name="irish" type="checkbox" value="irish">
|
119
|
+
<label class="govuk-label govuk-checkboxes__label" for="item_irish">
|
120
|
+
Irish
|
121
|
+
</label>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</fieldset>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
|
129
|
+
#### Macro
|
130
|
+
|
131
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
132
|
+
|
133
|
+
{{ govukCheckboxes({
|
134
|
+
"fieldset": {
|
135
|
+
"legend": {
|
136
|
+
"text": "What is your nationality?"
|
137
|
+
}
|
138
|
+
},
|
139
|
+
"hint": {
|
140
|
+
"text": "If you have dual nationality, select all options that are relevant to you."
|
141
|
+
},
|
142
|
+
"items": [
|
143
|
+
{
|
144
|
+
"name": "british",
|
145
|
+
"id": "item_british",
|
146
|
+
"value": "yes",
|
147
|
+
"text": "British"
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"name": "irish",
|
151
|
+
"id": "item_irish",
|
152
|
+
"value": "irish",
|
153
|
+
"text": "Irish"
|
154
|
+
}
|
155
|
+
]
|
156
|
+
}) }}
|
157
|
+
|
158
|
+
### Checkboxes--with-disabled
|
159
|
+
|
160
|
+
[Preview the checkboxes--with-disabled example](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-disabled/preview)
|
161
|
+
|
162
|
+
#### Markup
|
163
|
+
|
164
|
+
<div class="govuk-form-group">
|
165
|
+
|
166
|
+
<div class="govuk-checkboxes">
|
167
|
+
|
168
|
+
<div class="govuk-checkboxes__item">
|
169
|
+
<input class="govuk-checkboxes__input" id="colours-1" name="colours" type="checkbox" value="red">
|
170
|
+
<label class="govuk-label govuk-checkboxes__label" for="colours-1">
|
171
|
+
Red
|
172
|
+
</label>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div class="govuk-checkboxes__item">
|
176
|
+
<input class="govuk-checkboxes__input" id="colours-2" name="colours" type="checkbox" value="green">
|
177
|
+
<label class="govuk-label govuk-checkboxes__label" for="colours-2">
|
178
|
+
Green
|
179
|
+
</label>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div class="govuk-checkboxes__item">
|
183
|
+
<input class="govuk-checkboxes__input" id="colours-3" name="colours" type="checkbox" value="blue" disabled>
|
184
|
+
<label class="govuk-label govuk-checkboxes__label" for="colours-3">
|
185
|
+
Blue
|
186
|
+
</label>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
#### Macro
|
194
|
+
|
195
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
196
|
+
|
197
|
+
{{ govukCheckboxes({
|
198
|
+
"name": "colours",
|
199
|
+
"items": [
|
200
|
+
{
|
201
|
+
"value": "red",
|
202
|
+
"text": "Red"
|
203
|
+
},
|
204
|
+
{
|
205
|
+
"value": "green",
|
206
|
+
"text": "Green"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
"value": "blue",
|
210
|
+
"text": "Blue",
|
211
|
+
"disabled": true
|
212
|
+
}
|
213
|
+
]
|
214
|
+
}) }}
|
215
|
+
|
216
|
+
### Checkboxes--with-html
|
217
|
+
|
218
|
+
[Preview the checkboxes--with-html example](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-html/preview)
|
219
|
+
|
220
|
+
#### Markup
|
221
|
+
|
222
|
+
<div class="govuk-form-group">
|
223
|
+
|
224
|
+
<fieldset class="govuk-fieldset" aria-describedby="waste-hint">
|
225
|
+
|
226
|
+
<legend class="govuk-fieldset__legend">
|
227
|
+
<h3 class="govuk-heading-m">Which types of waste do you transport regularly?</h3>
|
228
|
+
</legend>
|
229
|
+
|
230
|
+
<span id="waste-hint" class="govuk-hint">
|
231
|
+
Select all that apply
|
232
|
+
</span>
|
233
|
+
|
234
|
+
<div class="govuk-checkboxes">
|
235
|
+
|
236
|
+
<div class="govuk-checkboxes__item">
|
237
|
+
<input class="govuk-checkboxes__input" id="waste-1" name="waste" type="checkbox" value="animal">
|
238
|
+
<label class="govuk-label govuk-checkboxes__label" for="waste-1">
|
239
|
+
Waste from animal carcasses
|
240
|
+
</label>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div class="govuk-checkboxes__item">
|
244
|
+
<input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
|
245
|
+
<label class="govuk-label govuk-checkboxes__label" for="waste-2">
|
246
|
+
Waste from mines or quarries
|
247
|
+
</label>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="govuk-checkboxes__item">
|
251
|
+
<input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
|
252
|
+
<label class="govuk-label govuk-checkboxes__label" for="waste-3">
|
253
|
+
Farm or agricultural waste
|
254
|
+
</label>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
</fieldset>
|
259
|
+
|
260
|
+
</div>
|
261
|
+
|
262
|
+
#### Macro
|
263
|
+
|
264
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
265
|
+
|
266
|
+
{{ govukCheckboxes({
|
267
|
+
"name": "waste",
|
268
|
+
"fieldset": {
|
269
|
+
"legend": {
|
270
|
+
"html": "<h3 class=\"govuk-heading-m\">Which types of waste do you transport regularly?</h3>"
|
271
|
+
}
|
272
|
+
},
|
273
|
+
"hint": {
|
274
|
+
"text": "Select all that apply"
|
275
|
+
},
|
276
|
+
"items": [
|
277
|
+
{
|
278
|
+
"value": "animal",
|
279
|
+
"text": "Waste from animal carcasses"
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"value": "mines",
|
283
|
+
"text": "Waste from mines or quarries"
|
284
|
+
},
|
285
|
+
{
|
286
|
+
"value": "farm",
|
287
|
+
"text": "Farm or agricultural waste"
|
288
|
+
}
|
289
|
+
]
|
290
|
+
}) }}
|
291
|
+
|
292
|
+
### Checkboxes--without-fieldset
|
293
|
+
|
294
|
+
[Preview the checkboxes--without-fieldset example](http://govuk-frontend-review.herokuapp.com/components/checkboxes/without-fieldset/preview)
|
295
|
+
|
296
|
+
#### Markup
|
297
|
+
|
298
|
+
<div class="govuk-form-group">
|
299
|
+
|
300
|
+
<div class="govuk-checkboxes">
|
301
|
+
|
302
|
+
<div class="govuk-checkboxes__item">
|
303
|
+
<input class="govuk-checkboxes__input" id="colours-1" name="colours" type="checkbox" value="red">
|
304
|
+
<label class="govuk-label govuk-checkboxes__label" for="colours-1">
|
305
|
+
Red
|
306
|
+
</label>
|
307
|
+
</div>
|
308
|
+
|
309
|
+
<div class="govuk-checkboxes__item">
|
310
|
+
<input class="govuk-checkboxes__input" id="colours-2" name="colours" type="checkbox" value="green">
|
311
|
+
<label class="govuk-label govuk-checkboxes__label" for="colours-2">
|
312
|
+
Green
|
313
|
+
</label>
|
314
|
+
</div>
|
315
|
+
|
316
|
+
<div class="govuk-checkboxes__item">
|
317
|
+
<input class="govuk-checkboxes__input" id="colours-3" name="colours" type="checkbox" value="blue">
|
318
|
+
<label class="govuk-label govuk-checkboxes__label" for="colours-3">
|
319
|
+
Blue
|
320
|
+
</label>
|
321
|
+
</div>
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
#### Macro
|
328
|
+
|
329
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
330
|
+
|
331
|
+
{{ govukCheckboxes({
|
332
|
+
"name": "colours",
|
333
|
+
"items": [
|
334
|
+
{
|
335
|
+
"value": "red",
|
336
|
+
"text": "Red"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
"value": "green",
|
340
|
+
"text": "Green"
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"value": "blue",
|
344
|
+
"text": "Blue"
|
345
|
+
}
|
346
|
+
]
|
347
|
+
}) }}
|
348
|
+
|
349
|
+
### Checkboxes--with-extreme-fieldset
|
350
|
+
|
351
|
+
[Preview the checkboxes--with-extreme-fieldset example](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-extreme-fieldset/preview)
|
352
|
+
|
353
|
+
#### Markup
|
354
|
+
|
355
|
+
<div class="govuk-form-group govuk-form-group--error">
|
356
|
+
|
357
|
+
<fieldset class="govuk-fieldset app-fieldset--custom-modifier" aria-describedby="example-hint example-error" data-attribute="value" data-second-attribute="second-value">
|
358
|
+
|
359
|
+
<legend class="govuk-fieldset__legend">
|
360
|
+
What is your nationality?
|
361
|
+
</legend>
|
362
|
+
|
363
|
+
<span id="example-hint" class="govuk-hint">
|
364
|
+
If you have dual nationality, select all options that are relevant to you.
|
365
|
+
</span>
|
366
|
+
|
367
|
+
<span id="example-error" class="govuk-error-message">
|
368
|
+
Please select an option
|
369
|
+
</span>
|
370
|
+
|
371
|
+
<div class="govuk-checkboxes">
|
372
|
+
|
373
|
+
<div class="govuk-checkboxes__item">
|
374
|
+
<input class="govuk-checkboxes__input" id="example-1" name="example" type="checkbox" value="british">
|
375
|
+
<label class="govuk-label govuk-checkboxes__label" for="example-1">
|
376
|
+
British
|
377
|
+
</label>
|
378
|
+
</div>
|
379
|
+
|
380
|
+
<div class="govuk-checkboxes__item">
|
381
|
+
<input class="govuk-checkboxes__input" id="example-2" name="example" type="checkbox" value="irish">
|
382
|
+
<label class="govuk-label govuk-checkboxes__label" for="example-2">
|
383
|
+
Irish
|
384
|
+
</label>
|
385
|
+
</div>
|
386
|
+
|
387
|
+
<div class="govuk-checkboxes__item">
|
388
|
+
<input class="govuk-checkboxes__input" id="example-3" name="example" type="checkbox" value="other">
|
389
|
+
<label class="govuk-label govuk-checkboxes__label" for="example-3">
|
390
|
+
Citizen of another country
|
391
|
+
</label>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
</div>
|
395
|
+
</fieldset>
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
#### Macro
|
400
|
+
|
401
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
402
|
+
|
403
|
+
{{ govukCheckboxes({
|
404
|
+
"idPrefix": "example",
|
405
|
+
"name": "example",
|
406
|
+
"fieldset": {
|
407
|
+
"classes": "app-fieldset--custom-modifier",
|
408
|
+
"attributes": {
|
409
|
+
"data-attribute": "value",
|
410
|
+
"data-second-attribute": "second-value"
|
411
|
+
},
|
412
|
+
"legend": {
|
413
|
+
"text": "What is your nationality?"
|
414
|
+
}
|
415
|
+
},
|
416
|
+
"hint": {
|
417
|
+
"text": "If you have dual nationality, select all options that are relevant to you."
|
418
|
+
},
|
419
|
+
"errorMessage": {
|
420
|
+
"text": "Please select an option"
|
421
|
+
},
|
422
|
+
"items": [
|
423
|
+
{
|
424
|
+
"value": "british",
|
425
|
+
"text": "British"
|
426
|
+
},
|
427
|
+
{
|
428
|
+
"value": "irish",
|
429
|
+
"text": "Irish"
|
430
|
+
},
|
431
|
+
{
|
432
|
+
"value": "other",
|
433
|
+
"text": "Citizen of another country"
|
434
|
+
}
|
435
|
+
]
|
436
|
+
}) }}
|
437
|
+
|
438
|
+
### Checkboxes--with-error
|
439
|
+
|
440
|
+
[Preview the checkboxes--with-error example](http://govuk-frontend-review.herokuapp.com/components/checkboxes/with-error/preview)
|
441
|
+
|
442
|
+
#### Markup
|
443
|
+
|
444
|
+
<div class="govuk-form-group govuk-form-group--error">
|
445
|
+
|
446
|
+
<fieldset class="govuk-fieldset" aria-describedby="waste-error">
|
447
|
+
|
448
|
+
<legend class="govuk-fieldset__legend">
|
449
|
+
<h3 class="govuk-heading-m">Which types of waste do you transport regularly?</h3>
|
450
|
+
</legend>
|
451
|
+
|
452
|
+
<span id="waste-error" class="govuk-error-message">
|
453
|
+
Please select an option
|
454
|
+
</span>
|
455
|
+
|
456
|
+
<div class="govuk-checkboxes">
|
457
|
+
|
458
|
+
<div class="govuk-checkboxes__item">
|
459
|
+
<input class="govuk-checkboxes__input" id="waste-1" name="waste" type="checkbox" value="animal">
|
460
|
+
<label class="govuk-label govuk-checkboxes__label" for="waste-1">
|
461
|
+
Waste from animal carcasses
|
462
|
+
</label>
|
463
|
+
</div>
|
464
|
+
|
465
|
+
<div class="govuk-checkboxes__item">
|
466
|
+
<input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines">
|
467
|
+
<label class="govuk-label govuk-checkboxes__label" for="waste-2">
|
468
|
+
Waste from mines or quarries
|
469
|
+
</label>
|
470
|
+
</div>
|
471
|
+
|
472
|
+
<div class="govuk-checkboxes__item">
|
473
|
+
<input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm">
|
474
|
+
<label class="govuk-label govuk-checkboxes__label" for="waste-3">
|
475
|
+
Farm or agricultural waste
|
476
|
+
</label>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
</div>
|
480
|
+
</fieldset>
|
481
|
+
|
482
|
+
</div>
|
483
|
+
|
484
|
+
#### Macro
|
485
|
+
|
486
|
+
{% from 'checkboxes/macro.njk' import govukCheckboxes %}
|
487
|
+
|
488
|
+
{{ govukCheckboxes({
|
489
|
+
"name": "waste",
|
490
|
+
"errorMessage": {
|
491
|
+
"text": "Please select an option"
|
492
|
+
},
|
493
|
+
"fieldset": {
|
494
|
+
"legend": {
|
495
|
+
"html": "<h3 class=\"govuk-heading-m\">Which types of waste do you transport regularly?</h3>"
|
496
|
+
}
|
497
|
+
},
|
498
|
+
"items": [
|
499
|
+
{
|
500
|
+
"value": "animal",
|
501
|
+
"text": "Waste from animal carcasses"
|
502
|
+
},
|
503
|
+
{
|
504
|
+
"value": "mines",
|
505
|
+
"text": "Waste from mines or quarries"
|
506
|
+
},
|
507
|
+
{
|
508
|
+
"value": "farm",
|
509
|
+
"text": "Farm or agricultural waste"
|
510
|
+
}
|
511
|
+
]
|
512
|
+
}) }}
|
513
|
+
|
514
|
+
## Requirements
|
515
|
+
|
516
|
+
### Build tool configuration
|
517
|
+
|
518
|
+
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
519
|
+
|
520
|
+
.pipe(sass({
|
521
|
+
includePaths: 'node_modules/'
|
522
|
+
}))
|
523
|
+
|
524
|
+
### Static asset path configuration
|
525
|
+
|
526
|
+
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:
|
527
|
+
|
528
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
529
|
+
|
530
|
+
## Component arguments
|
531
|
+
|
532
|
+
If you are using Nunjucks,then macros take the following arguments
|
533
|
+
|
534
|
+
**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
|
535
|
+
|
536
|
+
<table class="govuk-table">
|
537
|
+
|
538
|
+
<thead class="govuk-table__head">
|
539
|
+
|
540
|
+
<tr class="govuk-table__row">
|
541
|
+
|
542
|
+
<th class="govuk-table__header" scope="col">Name</th>
|
543
|
+
|
544
|
+
<th class="govuk-table__header" scope="col">Type</th>
|
545
|
+
|
546
|
+
<th class="govuk-table__header" scope="col">Required</th>
|
547
|
+
|
548
|
+
<th class="govuk-table__header" scope="col">Description</th>
|
549
|
+
|
550
|
+
</tr>
|
551
|
+
|
552
|
+
</thead>
|
553
|
+
|
554
|
+
<tbody class="govuk-table__body">
|
555
|
+
|
556
|
+
<tr class="govuk-table__row">
|
557
|
+
|
558
|
+
<th class="govuk-table__header" scope="row">fieldset</th>
|
559
|
+
|
560
|
+
<td class="govuk-table__cell ">object</td>
|
561
|
+
|
562
|
+
<td class="govuk-table__cell ">No</td>
|
563
|
+
|
564
|
+
<td class="govuk-table__cell ">Arguments for the fieldset component (e.g. legend). See fieldset component.</td>
|
565
|
+
|
566
|
+
</tr>
|
567
|
+
|
568
|
+
<tr class="govuk-table__row">
|
569
|
+
|
570
|
+
<th class="govuk-table__header" scope="row">hint</th>
|
571
|
+
|
572
|
+
<td class="govuk-table__cell ">object</td>
|
573
|
+
|
574
|
+
<td class="govuk-table__cell ">No</td>
|
575
|
+
|
576
|
+
<td class="govuk-table__cell ">Arguments for the hint component (e.g. text). See hint component.</td>
|
577
|
+
|
578
|
+
</tr>
|
579
|
+
|
580
|
+
<tr class="govuk-table__row">
|
581
|
+
|
582
|
+
<th class="govuk-table__header" scope="row">errorMessage</th>
|
583
|
+
|
584
|
+
<td class="govuk-table__cell ">object</td>
|
585
|
+
|
586
|
+
<td class="govuk-table__cell ">No</td>
|
587
|
+
|
588
|
+
<td class="govuk-table__cell ">Arguments for the errorMessage component (e.g. text). See errorMessage component.</td>
|
589
|
+
|
590
|
+
</tr>
|
591
|
+
|
592
|
+
<tr class="govuk-table__row">
|
593
|
+
|
594
|
+
<th class="govuk-table__header" scope="row">idPrefix</th>
|
595
|
+
|
596
|
+
<td class="govuk-table__cell ">string</td>
|
597
|
+
|
598
|
+
<td class="govuk-table__cell ">No</td>
|
599
|
+
|
600
|
+
<td class="govuk-table__cell ">String to prefix id for each checkbox item if no id is specified on each item. If`idPrefix` is not passed, fallback to using the name attribute instead.</td>
|
601
|
+
|
602
|
+
</tr>
|
603
|
+
|
604
|
+
<tr class="govuk-table__row">
|
605
|
+
|
606
|
+
<th class="govuk-table__header" scope="row">name</th>
|
607
|
+
|
608
|
+
<td class="govuk-table__cell ">string</td>
|
609
|
+
|
610
|
+
<td class="govuk-table__cell ">Yes</td>
|
611
|
+
|
612
|
+
<td class="govuk-table__cell ">Name attribute for each checkbox item.</td>
|
613
|
+
|
614
|
+
</tr>
|
615
|
+
|
616
|
+
<tr class="govuk-table__row">
|
617
|
+
|
618
|
+
<th class="govuk-table__header" scope="row">items</th>
|
619
|
+
|
620
|
+
<td class="govuk-table__cell ">array</td>
|
621
|
+
|
622
|
+
<td class="govuk-table__cell ">Yes</td>
|
623
|
+
|
624
|
+
<td class="govuk-table__cell ">Array of checkbox items objects.</td>
|
625
|
+
|
626
|
+
</tr>
|
627
|
+
|
628
|
+
<tr class="govuk-table__row">
|
629
|
+
|
630
|
+
<th class="govuk-table__header" scope="row">items.{}.text (or) items.{}.html</th>
|
631
|
+
|
632
|
+
<td class="govuk-table__cell ">string</td>
|
633
|
+
|
634
|
+
<td class="govuk-table__cell ">Yes</td>
|
635
|
+
|
636
|
+
<td class="govuk-table__cell ">Text or HTML to use within each checkbox item label. If `html` is provided, the `text` argument will be ignored.</td>
|
637
|
+
|
638
|
+
</tr>
|
639
|
+
|
640
|
+
<tr class="govuk-table__row">
|
641
|
+
|
642
|
+
<th class="govuk-table__header" scope="row">items.{}.id</th>
|
643
|
+
|
644
|
+
<td class="govuk-table__cell ">string</td>
|
645
|
+
|
646
|
+
<td class="govuk-table__cell ">No</td>
|
647
|
+
|
648
|
+
<td class="govuk-table__cell ">Specific id attribute for the checkbox item. If ommited, then `idPrefix` string will be applied.</td>
|
649
|
+
|
650
|
+
</tr>
|
651
|
+
|
652
|
+
<tr class="govuk-table__row">
|
653
|
+
|
654
|
+
<th class="govuk-table__header" scope="row">items.{}.name</th>
|
655
|
+
|
656
|
+
<td class="govuk-table__cell ">string</td>
|
657
|
+
|
658
|
+
<td class="govuk-table__cell ">Yes</td>
|
659
|
+
|
660
|
+
<td class="govuk-table__cell ">Specific name for the checkbox item. If ommited, then component global `name` string will be applied.</td>
|
661
|
+
|
662
|
+
</tr>
|
663
|
+
|
664
|
+
<tr class="govuk-table__row">
|
665
|
+
|
666
|
+
<th class="govuk-table__header" scope="row">items.{}.value</th>
|
667
|
+
|
668
|
+
<td class="govuk-table__cell ">string</td>
|
669
|
+
|
670
|
+
<td class="govuk-table__cell ">Yes</td>
|
671
|
+
|
672
|
+
<td class="govuk-table__cell ">Value for the checkbox input.</td>
|
673
|
+
|
674
|
+
</tr>
|
675
|
+
|
676
|
+
<tr class="govuk-table__row">
|
677
|
+
|
678
|
+
<th class="govuk-table__header" scope="row">items.{}.label</th>
|
679
|
+
|
680
|
+
<td class="govuk-table__cell ">object</td>
|
681
|
+
|
682
|
+
<td class="govuk-table__cell ">No</td>
|
683
|
+
|
684
|
+
<td class="govuk-table__cell ">Provide additional attributes to each checkbox item label. See `label` component for more details.</td>
|
685
|
+
|
686
|
+
</tr>
|
687
|
+
|
688
|
+
<tr class="govuk-table__row">
|
689
|
+
|
690
|
+
<th class="govuk-table__header" scope="row">items.{}.checked</th>
|
691
|
+
|
692
|
+
<td class="govuk-table__cell ">boolean</td>
|
693
|
+
|
694
|
+
<td class="govuk-table__cell ">No</td>
|
695
|
+
|
696
|
+
<td class="govuk-table__cell ">If true, checkbox will be checked.</td>
|
697
|
+
|
698
|
+
</tr>
|
699
|
+
|
700
|
+
<tr class="govuk-table__row">
|
701
|
+
|
702
|
+
<th class="govuk-table__header" scope="row">items.{}.conditional</th>
|
703
|
+
|
704
|
+
<td class="govuk-table__cell ">boolean</td>
|
705
|
+
|
706
|
+
<td class="govuk-table__cell ">No</td>
|
707
|
+
|
708
|
+
<td class="govuk-table__cell ">If true, content provided will be revealed when the item is checked.</td>
|
709
|
+
|
710
|
+
</tr>
|
711
|
+
|
712
|
+
<tr class="govuk-table__row">
|
713
|
+
|
714
|
+
<th class="govuk-table__header" scope="row">items.{}.conditional.html</th>
|
715
|
+
|
716
|
+
<td class="govuk-table__cell ">boolean</td>
|
717
|
+
|
718
|
+
<td class="govuk-table__cell ">No</td>
|
719
|
+
|
720
|
+
<td class="govuk-table__cell ">Provide content for the conditional reveal.</td>
|
721
|
+
|
722
|
+
</tr>
|
723
|
+
|
724
|
+
<tr class="govuk-table__row">
|
725
|
+
|
726
|
+
<th class="govuk-table__header" scope="row">items.{}.disabled</th>
|
727
|
+
|
728
|
+
<td class="govuk-table__cell ">boolean</td>
|
729
|
+
|
730
|
+
<td class="govuk-table__cell ">No</td>
|
731
|
+
|
732
|
+
<td class="govuk-table__cell ">If true, checkbox will be disabled.</td>
|
733
|
+
|
734
|
+
</tr>
|
735
|
+
|
736
|
+
<tr class="govuk-table__row">
|
737
|
+
|
738
|
+
<th class="govuk-table__header" scope="row">classes</th>
|
739
|
+
|
740
|
+
<td class="govuk-table__cell ">string</td>
|
741
|
+
|
742
|
+
<td class="govuk-table__cell ">No</td>
|
743
|
+
|
744
|
+
<td class="govuk-table__cell ">Optional additional classes to add to the checkboxes container.</td>
|
745
|
+
|
746
|
+
</tr>
|
747
|
+
|
748
|
+
<tr class="govuk-table__row">
|
749
|
+
|
750
|
+
<th class="govuk-table__header" scope="row">attributes</th>
|
751
|
+
|
752
|
+
<td class="govuk-table__cell ">object</td>
|
753
|
+
|
754
|
+
<td class="govuk-table__cell ">No</td>
|
755
|
+
|
756
|
+
<td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the checkboxes container.</td>
|
757
|
+
|
758
|
+
</tr>
|
759
|
+
|
760
|
+
</tbody>
|
761
|
+
|
762
|
+
</table>
|
763
|
+
|
764
|
+
**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
|
765
|
+
|
766
|
+
### Setting up Nunjucks views and paths
|
767
|
+
|
768
|
+
Below is an example setup using express configure views:
|
769
|
+
|
770
|
+
nunjucks.configure('node_modules/govuk-frontend/components', {
|
771
|
+
autoescape: true,
|
772
|
+
cache: false,
|
773
|
+
express: app
|
774
|
+
})
|
775
|
+
|
776
|
+
## Contribution
|
777
|
+
|
778
|
+
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")
|
779
|
+
|
780
|
+
## License
|
781
|
+
|
782
|
+
MIT
|