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,82 @@
|
|
1
|
+
<header class="govuk-header {{ params.classes if params.classes }}" role="banner" data-module="header"
|
2
|
+
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
3
|
+
<div class="govuk-header__container {{ params.containerClasses | default('govuk-width-container') }}">
|
4
|
+
|
5
|
+
<div class="govuk-header__logo">
|
6
|
+
<a href="{{ params.homepageUrl | default('/') }}" class="govuk-header__link govuk-header__link--homepage">
|
7
|
+
<span class="govuk-header__logotype">
|
8
|
+
{# We use an inline SVG for the crown so that we can cascade the
|
9
|
+
currentColor into the crown whilst continuing to support older browsers
|
10
|
+
which do not support external SVGs without a Javascript polyfill. This
|
11
|
+
adds approximately 1kb to every page load.
|
12
|
+
|
13
|
+
We use currentColour so that we can easily invert it when printing and
|
14
|
+
when the focus state is applied. This also benefits users who override
|
15
|
+
colours in their browser as they will still see the crown.
|
16
|
+
|
17
|
+
The SVG needs `focusable="false"` so that Internet Explorer does not
|
18
|
+
treat it as an interactive element - without this it will be
|
19
|
+
'focusable' when using the keyboard to navigate. #}
|
20
|
+
<svg
|
21
|
+
role="presentation"
|
22
|
+
focusable="false"
|
23
|
+
class="govuk-header__logotype-crown"
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
25
|
+
viewbox="0 0 132 97"
|
26
|
+
height="32"
|
27
|
+
width="36"
|
28
|
+
>
|
29
|
+
<path
|
30
|
+
fill="currentColor" fill-rule="evenodd"
|
31
|
+
d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"
|
32
|
+
></path>
|
33
|
+
{# Fallback PNG image for older browsers.
|
34
|
+
|
35
|
+
The <image> element is a valid SVG element. In SVG, you would specify
|
36
|
+
the URL of the image file with the xlink:href – as we don't reference an
|
37
|
+
image it has no effect. It's important to include the empty xlink:href
|
38
|
+
attribute as this prevents versions of IE which support SVG from
|
39
|
+
downloading the fallback image when they don't need to.
|
40
|
+
|
41
|
+
In other browsers <image> is synonymous for the <img> tag and will be
|
42
|
+
interpreted as such, displaying the fallback image. #}
|
43
|
+
<image src="{{ params.assetsPath | default('/assets/images') }}/govuk-logotype-crown.png" class="govuk-header__logotype-crown-fallback-image"></image>
|
44
|
+
</svg>
|
45
|
+
<span class="govuk-header__logotype-text">
|
46
|
+
GOV.UK
|
47
|
+
</span>
|
48
|
+
</span>
|
49
|
+
{% if (params.productName) %}
|
50
|
+
<span class="govuk-header__product-name">
|
51
|
+
{{ params.productName }}
|
52
|
+
</span>
|
53
|
+
{% endif %}
|
54
|
+
</a>
|
55
|
+
</div><div class="govuk-header__content">
|
56
|
+
|
57
|
+
{% if (params.serviceName) %}
|
58
|
+
<a href="{{ params.serviceUrl }}" class="govuk-header__link govuk-header__link--service-name">
|
59
|
+
{{ params.serviceName }}
|
60
|
+
</a>
|
61
|
+
{% endif %}
|
62
|
+
|
63
|
+
{% if params.navigation %}
|
64
|
+
<button role="button" class="govuk-header__menu-button js-header-toggle" aria-controls="navigation" aria-label="Show or hide Top Level Navigation">Menu</button>
|
65
|
+
<nav>
|
66
|
+
<ul id="navigation" class="govuk-header__navigation {{ params.navigationClasses if params.navigationClasses }}" aria-label="Top Level Navigation">
|
67
|
+
{% for item in params.navigation %}
|
68
|
+
{% if item.href and item.text %}
|
69
|
+
<li class="govuk-header__navigation-item{{ ' govuk-header__navigation-item--active' if item.active }}">
|
70
|
+
<a class="govuk-header__link" href="{{ item.href }}">
|
71
|
+
{{ item.text }}
|
72
|
+
</a>
|
73
|
+
</li>
|
74
|
+
{% endif %}
|
75
|
+
{% endfor %}
|
76
|
+
</ul>
|
77
|
+
</nav>
|
78
|
+
{% endif %}
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
</header>
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# Hint
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Use hint text for supporting contextual help
|
6
|
+
|
7
|
+
## Quick start examples
|
8
|
+
|
9
|
+
### Component default
|
10
|
+
|
11
|
+
[Preview the hint component](http://govuk-frontend-review.herokuapp.com/components/hint/preview)
|
12
|
+
|
13
|
+
#### Markup
|
14
|
+
|
15
|
+
<span class="govuk-hint">
|
16
|
+
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
17
|
+
</span>
|
18
|
+
|
19
|
+
#### Macro
|
20
|
+
|
21
|
+
{% from 'hint/macro.njk' import govukHint %}
|
22
|
+
|
23
|
+
{{ govukHint({
|
24
|
+
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
25
|
+
}) }}
|
26
|
+
|
27
|
+
### Hint--with html
|
28
|
+
|
29
|
+
[Preview the hint--with html example](http://govuk-frontend-review.herokuapp.com/components/hint/with html/preview)
|
30
|
+
|
31
|
+
#### Markup
|
32
|
+
|
33
|
+
<span class="govuk-hint">
|
34
|
+
It’s on your National Insurance card, benefit letter, payslip or <a class="govuk-link" href="#">P60</a>. For example, ‘QQ 12 34 56 C’.
|
35
|
+
</span>
|
36
|
+
|
37
|
+
#### Macro
|
38
|
+
|
39
|
+
{% from 'hint/macro.njk' import govukHint %}
|
40
|
+
|
41
|
+
{{ govukHint({
|
42
|
+
"html": "It’s on your National Insurance card, benefit letter, payslip or <a class=\"govuk-link\" href=\"#\">P60</a>. For example, ‘QQ 12 34 56 C’."
|
43
|
+
}) }}
|
44
|
+
|
45
|
+
## Requirements
|
46
|
+
|
47
|
+
### Build tool configuration
|
48
|
+
|
49
|
+
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
50
|
+
|
51
|
+
.pipe(sass({
|
52
|
+
includePaths: 'node_modules/'
|
53
|
+
}))
|
54
|
+
|
55
|
+
### Static asset path configuration
|
56
|
+
|
57
|
+
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:
|
58
|
+
|
59
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
60
|
+
|
61
|
+
## Component arguments
|
62
|
+
|
63
|
+
If you are using Nunjucks,then macros take the following arguments
|
64
|
+
|
65
|
+
**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).**
|
66
|
+
|
67
|
+
<table class="govuk-table">
|
68
|
+
|
69
|
+
<thead class="govuk-table__head">
|
70
|
+
|
71
|
+
<tr class="govuk-table__row">
|
72
|
+
|
73
|
+
<th class="govuk-table__header" scope="col">Name</th>
|
74
|
+
|
75
|
+
<th class="govuk-table__header" scope="col">Type</th>
|
76
|
+
|
77
|
+
<th class="govuk-table__header" scope="col">Required</th>
|
78
|
+
|
79
|
+
<th class="govuk-table__header" scope="col">Description</th>
|
80
|
+
|
81
|
+
</tr>
|
82
|
+
|
83
|
+
</thead>
|
84
|
+
|
85
|
+
<tbody class="govuk-table__body">
|
86
|
+
|
87
|
+
<tr class="govuk-table__row">
|
88
|
+
|
89
|
+
<th class="govuk-table__header" scope="row">text or (html) html</th>
|
90
|
+
|
91
|
+
<td class="govuk-table__cell ">string</td>
|
92
|
+
|
93
|
+
<td class="govuk-table__cell ">Yes</td>
|
94
|
+
|
95
|
+
<td class="govuk-table__cell ">Text or HTML to use within the hint. If `html` is provided, the `text` argument will be ignored.</td>
|
96
|
+
|
97
|
+
</tr>
|
98
|
+
|
99
|
+
<tr class="govuk-table__row">
|
100
|
+
|
101
|
+
<th class="govuk-table__header" scope="row">id</th>
|
102
|
+
|
103
|
+
<td class="govuk-table__cell ">string</td>
|
104
|
+
|
105
|
+
<td class="govuk-table__cell ">Yes</td>
|
106
|
+
|
107
|
+
<td class="govuk-table__cell ">Optional id attribute o add to the hint span tag.</td>
|
108
|
+
|
109
|
+
</tr>
|
110
|
+
|
111
|
+
<tr class="govuk-table__row">
|
112
|
+
|
113
|
+
<th class="govuk-table__header" scope="row">classes</th>
|
114
|
+
|
115
|
+
<td class="govuk-table__cell ">string</td>
|
116
|
+
|
117
|
+
<td class="govuk-table__cell ">No</td>
|
118
|
+
|
119
|
+
<td class="govuk-table__cell ">Optional additional classes to add to the hint span tag.</td>
|
120
|
+
|
121
|
+
</tr>
|
122
|
+
|
123
|
+
<tr class="govuk-table__row">
|
124
|
+
|
125
|
+
<th class="govuk-table__header" scope="row">attributes</th>
|
126
|
+
|
127
|
+
<td class="govuk-table__cell ">object</td>
|
128
|
+
|
129
|
+
<td class="govuk-table__cell ">No</td>
|
130
|
+
|
131
|
+
<td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the hint span tag.</td>
|
132
|
+
|
133
|
+
</tr>
|
134
|
+
|
135
|
+
</tbody>
|
136
|
+
|
137
|
+
</table>
|
138
|
+
|
139
|
+
**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).**
|
140
|
+
|
141
|
+
### Setting up Nunjucks views and paths
|
142
|
+
|
143
|
+
Below is an example setup using express configure views:
|
144
|
+
|
145
|
+
nunjucks.configure('node_modules/govuk-frontend/components', {
|
146
|
+
autoescape: true,
|
147
|
+
cache: false,
|
148
|
+
express: app
|
149
|
+
})
|
150
|
+
|
151
|
+
## Contribution
|
152
|
+
|
153
|
+
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")
|
154
|
+
|
155
|
+
## License
|
156
|
+
|
157
|
+
MIT
|
@@ -0,0 +1,29 @@
|
|
1
|
+
@import "../../settings/all";
|
2
|
+
@import "../../tools/all";
|
3
|
+
@import "../../helpers/all";
|
4
|
+
|
5
|
+
@include govuk-exports("govuk/component/hint") {
|
6
|
+
.govuk-hint {
|
7
|
+
@include govuk-font($size: 19);
|
8
|
+
|
9
|
+
display: block;
|
10
|
+
|
11
|
+
margin-bottom: govuk-spacing(3);
|
12
|
+
|
13
|
+
color: $govuk-secondary-text-colour;
|
14
|
+
}
|
15
|
+
|
16
|
+
// Reduces margin-bottom of hint when used after the default label (no class)
|
17
|
+
// or govuk-label--s for better vertical alignment.
|
18
|
+
|
19
|
+
// This adjustment will not work when the label is inside the <h1>, however
|
20
|
+
// it is unlikely that the default or govuk-label--s class would be used in
|
21
|
+
// this case.
|
22
|
+
|
23
|
+
// This adjustment will not work in browsers that do not support :not()
|
24
|
+
// Users with these browsers will see the default size margin (5px larger)
|
25
|
+
|
26
|
+
.govuk-label:not(.govuk-label--m):not(.govuk-label--l):not(.govuk-label--xl) + .govuk-hint {
|
27
|
+
margin-bottom: govuk-spacing(2);
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<span {%- if params.id %} id="{{ params.id }}"{% endif %} class="govuk-hint {%- if params.classes %} {{ params.classes }}{% endif %}"
|
2
|
+
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
|
3
|
+
{{ params.html | safe if params.html else params.text }}
|
4
|
+
</span>
|
@@ -0,0 +1,416 @@
|
|
1
|
+
# Input
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
A single-line text field.
|
6
|
+
|
7
|
+
## Guidance
|
8
|
+
|
9
|
+
Find out when to use the Input component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/text-input).
|
10
|
+
|
11
|
+
## Quick start examples
|
12
|
+
|
13
|
+
### Component default
|
14
|
+
|
15
|
+
[Preview the input component](http://govuk-frontend-review.herokuapp.com/components/input/preview)
|
16
|
+
|
17
|
+
#### Markup
|
18
|
+
|
19
|
+
<div class="govuk-form-group">
|
20
|
+
<label class="govuk-label" for="input-example">
|
21
|
+
National Insurance number
|
22
|
+
</label>
|
23
|
+
|
24
|
+
<input class="govuk-input" id="input-example" name="test-name" type="text">
|
25
|
+
</div>
|
26
|
+
|
27
|
+
#### Macro
|
28
|
+
|
29
|
+
{% from 'input/macro.njk' import govukInput %}
|
30
|
+
|
31
|
+
{{ govukInput({
|
32
|
+
"label": {
|
33
|
+
"text": "National Insurance number"
|
34
|
+
},
|
35
|
+
"id": "input-example",
|
36
|
+
"name": "test-name"
|
37
|
+
}) }}
|
38
|
+
|
39
|
+
### Input--with-hint-text
|
40
|
+
|
41
|
+
[Preview the input--with-hint-text example](http://govuk-frontend-review.herokuapp.com/components/input/with-hint-text/preview)
|
42
|
+
|
43
|
+
#### Markup
|
44
|
+
|
45
|
+
<div class="govuk-form-group">
|
46
|
+
<label class="govuk-label" for="input-with-hint-text">
|
47
|
+
National insurance number
|
48
|
+
</label>
|
49
|
+
|
50
|
+
<span id="input-with-hint-text-hint" class="govuk-hint">
|
51
|
+
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
52
|
+
</span>
|
53
|
+
|
54
|
+
<input class="govuk-input" id="input-with-hint-text" name="test-name-2" type="text" aria-describedby="input-with-hint-text-hint">
|
55
|
+
</div>
|
56
|
+
|
57
|
+
#### Macro
|
58
|
+
|
59
|
+
{% from 'input/macro.njk' import govukInput %}
|
60
|
+
|
61
|
+
{{ govukInput({
|
62
|
+
"label": {
|
63
|
+
"text": "National insurance number"
|
64
|
+
},
|
65
|
+
"hint": {
|
66
|
+
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
67
|
+
},
|
68
|
+
"id": "input-with-hint-text",
|
69
|
+
"name": "test-name-2"
|
70
|
+
}) }}
|
71
|
+
|
72
|
+
### Input--with-error-message
|
73
|
+
|
74
|
+
[Preview the input--with-error-message example](http://govuk-frontend-review.herokuapp.com/components/input/with-error-message/preview)
|
75
|
+
|
76
|
+
#### Markup
|
77
|
+
|
78
|
+
<div class="govuk-form-group govuk-form-group--error">
|
79
|
+
<label class="govuk-label" for="input-with-error-message">
|
80
|
+
National Insurance number
|
81
|
+
</label>
|
82
|
+
|
83
|
+
<span id="input-with-error-message-hint" class="govuk-hint">
|
84
|
+
It’s on your <i>National Insurance card</i>, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
85
|
+
</span>
|
86
|
+
|
87
|
+
<span id="input-with-error-message-error" class="govuk-error-message">
|
88
|
+
Error message goes here
|
89
|
+
</span>
|
90
|
+
|
91
|
+
<input class="govuk-input govuk-input--error" id="input-with-error-message" name="test-name-3" type="text" aria-describedby="input-with-error-message-hint input-with-error-message-error">
|
92
|
+
</div>
|
93
|
+
|
94
|
+
#### Macro
|
95
|
+
|
96
|
+
{% from 'input/macro.njk' import govukInput %}
|
97
|
+
|
98
|
+
{{ govukInput({
|
99
|
+
"label": {
|
100
|
+
"text": "National Insurance number"
|
101
|
+
},
|
102
|
+
"hint": {
|
103
|
+
"html": "It’s on your <i>National Insurance card</i>, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
104
|
+
},
|
105
|
+
"id": "input-with-error-message",
|
106
|
+
"name": "test-name-3",
|
107
|
+
"errorMessage": {
|
108
|
+
"text": "Error message goes here"
|
109
|
+
}
|
110
|
+
}) }}
|
111
|
+
|
112
|
+
### Input--width-10
|
113
|
+
|
114
|
+
[Preview the input--width-10 example](http://govuk-frontend-review.herokuapp.com/components/input/width-10/preview)
|
115
|
+
|
116
|
+
#### Markup
|
117
|
+
|
118
|
+
<div class="govuk-form-group">
|
119
|
+
<label class="govuk-label" for="input-width-10">
|
120
|
+
National insurance number
|
121
|
+
</label>
|
122
|
+
|
123
|
+
<span id="input-width-10-hint" class="govuk-hint">
|
124
|
+
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
125
|
+
</span>
|
126
|
+
|
127
|
+
<input class="govuk-input govuk-input--width-10" id="input-width-10" name="test-name-4" type="text" aria-describedby="input-width-10-hint">
|
128
|
+
</div>
|
129
|
+
|
130
|
+
#### Macro
|
131
|
+
|
132
|
+
{% from 'input/macro.njk' import govukInput %}
|
133
|
+
|
134
|
+
{{ govukInput({
|
135
|
+
"label": {
|
136
|
+
"text": "National insurance number"
|
137
|
+
},
|
138
|
+
"hint": {
|
139
|
+
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
140
|
+
},
|
141
|
+
"id": "input-width-10",
|
142
|
+
"name": "test-name-4",
|
143
|
+
"classes": "govuk-input--width-10"
|
144
|
+
}) }}
|
145
|
+
|
146
|
+
### Input--width-20
|
147
|
+
|
148
|
+
[Preview the input--width-20 example](http://govuk-frontend-review.herokuapp.com/components/input/width-20/preview)
|
149
|
+
|
150
|
+
#### Markup
|
151
|
+
|
152
|
+
<div class="govuk-form-group">
|
153
|
+
<label class="govuk-label" for="input-width-20">
|
154
|
+
National insurance number
|
155
|
+
</label>
|
156
|
+
|
157
|
+
<span id="input-width-20-hint" class="govuk-hint">
|
158
|
+
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
159
|
+
</span>
|
160
|
+
|
161
|
+
<input class="govuk-input govuk-input--width-20" id="input-width-20" name="test-name-5" type="text" aria-describedby="input-width-20-hint">
|
162
|
+
</div>
|
163
|
+
|
164
|
+
#### Macro
|
165
|
+
|
166
|
+
{% from 'input/macro.njk' import govukInput %}
|
167
|
+
|
168
|
+
{{ govukInput({
|
169
|
+
"label": {
|
170
|
+
"text": "National insurance number"
|
171
|
+
},
|
172
|
+
"hint": {
|
173
|
+
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
174
|
+
},
|
175
|
+
"id": "input-width-20",
|
176
|
+
"name": "test-name-5",
|
177
|
+
"classes": "govuk-input--width-20"
|
178
|
+
}) }}
|
179
|
+
|
180
|
+
### Input--width-30
|
181
|
+
|
182
|
+
[Preview the input--width-30 example](http://govuk-frontend-review.herokuapp.com/components/input/width-30/preview)
|
183
|
+
|
184
|
+
#### Markup
|
185
|
+
|
186
|
+
<div class="govuk-form-group">
|
187
|
+
<label class="govuk-label" for="input-width-30">
|
188
|
+
National insurance number
|
189
|
+
</label>
|
190
|
+
|
191
|
+
<span id="input-width-30-hint" class="govuk-hint">
|
192
|
+
It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’.
|
193
|
+
</span>
|
194
|
+
|
195
|
+
<input class="govuk-input govuk-input--width-30" id="input-width-30" name="test-name-6" type="text" aria-describedby="input-width-30-hint">
|
196
|
+
</div>
|
197
|
+
|
198
|
+
#### Macro
|
199
|
+
|
200
|
+
{% from 'input/macro.njk' import govukInput %}
|
201
|
+
|
202
|
+
{{ govukInput({
|
203
|
+
"label": {
|
204
|
+
"text": "National insurance number"
|
205
|
+
},
|
206
|
+
"hint": {
|
207
|
+
"text": "It’s on your National Insurance card, benefit letter, payslip or P60\. For example, ‘QQ 12 34 56 C’."
|
208
|
+
},
|
209
|
+
"id": "input-width-30",
|
210
|
+
"name": "test-name-6",
|
211
|
+
"classes": "govuk-input--width-30"
|
212
|
+
}) }}
|
213
|
+
|
214
|
+
### Input--with-label-as-page-heading
|
215
|
+
|
216
|
+
[Preview the input--with-label-as-page-heading example](http://govuk-frontend-review.herokuapp.com/components/input/with-label-as-page-heading/preview)
|
217
|
+
|
218
|
+
#### Markup
|
219
|
+
|
220
|
+
<div class="govuk-form-group">
|
221
|
+
<h1 class="govuk-label-wrapper">
|
222
|
+
<label class="govuk-label" for="input-with-page-heading">
|
223
|
+
National Insurance number
|
224
|
+
</label>
|
225
|
+
|
226
|
+
</h1>
|
227
|
+
|
228
|
+
<input class="govuk-input" id="input-with-page-heading" name="test-name" type="text">
|
229
|
+
</div>
|
230
|
+
|
231
|
+
#### Macro
|
232
|
+
|
233
|
+
{% from 'input/macro.njk' import govukInput %}
|
234
|
+
|
235
|
+
{{ govukInput({
|
236
|
+
"label": {
|
237
|
+
"text": "National Insurance number",
|
238
|
+
"isPageHeading": true
|
239
|
+
},
|
240
|
+
"id": "input-with-page-heading",
|
241
|
+
"name": "test-name"
|
242
|
+
}) }}
|
243
|
+
|
244
|
+
## Requirements
|
245
|
+
|
246
|
+
### Build tool configuration
|
247
|
+
|
248
|
+
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
249
|
+
|
250
|
+
.pipe(sass({
|
251
|
+
includePaths: 'node_modules/'
|
252
|
+
}))
|
253
|
+
|
254
|
+
### Static asset path configuration
|
255
|
+
|
256
|
+
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:
|
257
|
+
|
258
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
259
|
+
|
260
|
+
## Component arguments
|
261
|
+
|
262
|
+
If you are using Nunjucks,then macros take the following arguments
|
263
|
+
|
264
|
+
**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).**
|
265
|
+
|
266
|
+
<table class="govuk-table">
|
267
|
+
|
268
|
+
<thead class="govuk-table__head">
|
269
|
+
|
270
|
+
<tr class="govuk-table__row">
|
271
|
+
|
272
|
+
<th class="govuk-table__header" scope="col">Name</th>
|
273
|
+
|
274
|
+
<th class="govuk-table__header" scope="col">Type</th>
|
275
|
+
|
276
|
+
<th class="govuk-table__header" scope="col">Required</th>
|
277
|
+
|
278
|
+
<th class="govuk-table__header" scope="col">Description</th>
|
279
|
+
|
280
|
+
</tr>
|
281
|
+
|
282
|
+
</thead>
|
283
|
+
|
284
|
+
<tbody class="govuk-table__body">
|
285
|
+
|
286
|
+
<tr class="govuk-table__row">
|
287
|
+
|
288
|
+
<th class="govuk-table__header" scope="row">id</th>
|
289
|
+
|
290
|
+
<td class="govuk-table__cell ">string</td>
|
291
|
+
|
292
|
+
<td class="govuk-table__cell ">Yes</td>
|
293
|
+
|
294
|
+
<td class="govuk-table__cell ">The id of the input.</td>
|
295
|
+
|
296
|
+
</tr>
|
297
|
+
|
298
|
+
<tr class="govuk-table__row">
|
299
|
+
|
300
|
+
<th class="govuk-table__header" scope="row">name</th>
|
301
|
+
|
302
|
+
<td class="govuk-table__cell ">string</td>
|
303
|
+
|
304
|
+
<td class="govuk-table__cell ">Yes</td>
|
305
|
+
|
306
|
+
<td class="govuk-table__cell ">The name of the input, which is submitted with the form data.</td>
|
307
|
+
|
308
|
+
</tr>
|
309
|
+
|
310
|
+
<tr class="govuk-table__row">
|
311
|
+
|
312
|
+
<th class="govuk-table__header" scope="row">type</th>
|
313
|
+
|
314
|
+
<td class="govuk-table__cell ">string</td>
|
315
|
+
|
316
|
+
<td class="govuk-table__cell ">No</td>
|
317
|
+
|
318
|
+
<td class="govuk-table__cell ">Type of input control to render. Defaults to "text".</td>
|
319
|
+
|
320
|
+
</tr>
|
321
|
+
|
322
|
+
<tr class="govuk-table__row">
|
323
|
+
|
324
|
+
<th class="govuk-table__header" scope="row">value</th>
|
325
|
+
|
326
|
+
<td class="govuk-table__cell ">string</td>
|
327
|
+
|
328
|
+
<td class="govuk-table__cell ">No</td>
|
329
|
+
|
330
|
+
<td class="govuk-table__cell ">Optional initial value of the input.</td>
|
331
|
+
|
332
|
+
</tr>
|
333
|
+
|
334
|
+
<tr class="govuk-table__row">
|
335
|
+
|
336
|
+
<th class="govuk-table__header" scope="row">label</th>
|
337
|
+
|
338
|
+
<td class="govuk-table__cell ">object</td>
|
339
|
+
|
340
|
+
<td class="govuk-table__cell ">No</td>
|
341
|
+
|
342
|
+
<td class="govuk-table__cell ">Arguments for the label component. See label component.</td>
|
343
|
+
|
344
|
+
</tr>
|
345
|
+
|
346
|
+
<tr class="govuk-table__row">
|
347
|
+
|
348
|
+
<th class="govuk-table__header" scope="row">hint</th>
|
349
|
+
|
350
|
+
<td class="govuk-table__cell ">object</td>
|
351
|
+
|
352
|
+
<td class="govuk-table__cell ">No</td>
|
353
|
+
|
354
|
+
<td class="govuk-table__cell ">Arguments for the hint component (e.g. text). See hint component.</td>
|
355
|
+
|
356
|
+
</tr>
|
357
|
+
|
358
|
+
<tr class="govuk-table__row">
|
359
|
+
|
360
|
+
<th class="govuk-table__header" scope="row">errorMessage</th>
|
361
|
+
|
362
|
+
<td class="govuk-table__cell ">object</td>
|
363
|
+
|
364
|
+
<td class="govuk-table__cell ">No</td>
|
365
|
+
|
366
|
+
<td class="govuk-table__cell ">Arguments for the errorMessage component (e.g. text). See errorMessage component.</td>
|
367
|
+
|
368
|
+
</tr>
|
369
|
+
|
370
|
+
<tr class="govuk-table__row">
|
371
|
+
|
372
|
+
<th class="govuk-table__header" scope="row">classes</th>
|
373
|
+
|
374
|
+
<td class="govuk-table__cell ">string</td>
|
375
|
+
|
376
|
+
<td class="govuk-table__cell ">No</td>
|
377
|
+
|
378
|
+
<td class="govuk-table__cell ">Optional additional classes add to the input component.</td>
|
379
|
+
|
380
|
+
</tr>
|
381
|
+
|
382
|
+
<tr class="govuk-table__row">
|
383
|
+
|
384
|
+
<th class="govuk-table__header" scope="row">attributes</th>
|
385
|
+
|
386
|
+
<td class="govuk-table__cell ">object</td>
|
387
|
+
|
388
|
+
<td class="govuk-table__cell ">No</td>
|
389
|
+
|
390
|
+
<td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the input component.</td>
|
391
|
+
|
392
|
+
</tr>
|
393
|
+
|
394
|
+
</tbody>
|
395
|
+
|
396
|
+
</table>
|
397
|
+
|
398
|
+
**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).**
|
399
|
+
|
400
|
+
### Setting up Nunjucks views and paths
|
401
|
+
|
402
|
+
Below is an example setup using express configure views:
|
403
|
+
|
404
|
+
nunjucks.configure('node_modules/govuk-frontend/components', {
|
405
|
+
autoescape: true,
|
406
|
+
cache: false,
|
407
|
+
express: app
|
408
|
+
})
|
409
|
+
|
410
|
+
## Contribution
|
411
|
+
|
412
|
+
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")
|
413
|
+
|
414
|
+
## License
|
415
|
+
|
416
|
+
MIT
|