-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from alphagov/examples-updates-19
Add "READY" content and examples
- Loading branch information
Showing
83 changed files
with
1,157 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
{% from "back-link/macro.njk" import govukBackLink %} | ||
|
||
{{ govukBackLink({ | ||
"text": "Back", | ||
"href": "#" | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: Back link | ||
description: Use the Back link component to help users go back to the previous page in a multi-page transaction. | ||
section: Components | ||
aliases: | ||
layout: layout-components.njk | ||
--- | ||
|
||
{% from "_example.njk" import example %} | ||
|
||
{{ example({group: 'components', item: 'back-link', example: 'default'}) }} | ||
|
||
Use the Back link component to help users go back to the previous page in a multi-page transaction. | ||
|
||
## When to use this component | ||
|
||
Always include the Back link component on GOV.UK [Question pages](../../patterns/question-pages). | ||
|
||
You can include a back link on other pages within a multi-page transaction, if it makes sense to do so. | ||
|
||
### When not to use this component | ||
|
||
Don’t use the Back link component together with [Breadcrumbs](../breadcrumbs). If necessary, you should do research with your users to find out which they find more helpful in your service. | ||
|
||
## How it works | ||
|
||
Back links must always go at the top of a page. | ||
|
||
Make sure the link takes users to the previous page, and that it works even when JavaScript isn’t available. | ||
|
||
There are 2 ways to use the Back link component. You can use HTML or, if you are using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](Insert prototype kit URL), you can use the Back link macro. | ||
|
||
{{ example({group: 'components', item: 'back-link', example: 'default', html: true, nunjucks: true, open: true}) }} | ||
|
||
## Research on this component | ||
|
||
If you’ve used this component, [get in touch](Anchor link to Get in touch panel at bottom of page) to share your user research findings. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
{% from "button/macro.njk" import govukButton %} | ||
|
||
{{ govukButton({ | ||
"text": "Save and continue" | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
{% from "button/macro.njk" import govukButton %} | ||
|
||
<h3 class="govuk-heading-m">Input button</h3> | ||
|
||
{{ govukButton({ | ||
"text": "Disabled button", | ||
"disabled": true | ||
}) }} | ||
|
||
<h3 class="govuk-heading-m">Link button</h3> | ||
|
||
{{ govukButton({ | ||
"text": "Disabled link button", | ||
"href": "/", | ||
"disabled": true | ||
}) }} | ||
|
||
<h3 class="govuk-heading-m"><button></h3> | ||
|
||
{{ govukButton({ | ||
"text": "Disabled <button>", | ||
"element": "button", | ||
"disabled": true | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: Button | ||
description: GOV.UK Button | ||
section: Components | ||
aliases: | ||
layout: layout-components.njk | ||
--- | ||
|
||
{% from "_example.njk" import example %} | ||
|
||
{{ example({group: 'components', item: 'button', example: 'default'}) }} | ||
|
||
## When to use this component | ||
|
||
Use the Button component to help users carry out an action on a GOV.UK page like starting an application or saving their progress. | ||
|
||
## How it works | ||
|
||
Write button text in sentence case, describing the action it performs. For example ‘Save and continue’ or ‘Start now’. | ||
|
||
Align the primary action button to the left edge of your form. | ||
|
||
There are 2 ways to use the Button component. You can use HTML or, if you are using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](Insert prototype kit URL), you can use the Button macro. | ||
|
||
{{ example({group: 'components', item: 'button', example: 'primary', html: true, nunjucks: true, open: true}) }} | ||
|
||
|
||
## Start buttons | ||
|
||
Use a start button as the main call to action on your service’s start page. | ||
|
||
{{ example({group: 'components', item: 'button', example: 'start', html: true, nunjucks: true, open: false}) }} | ||
|
||
### Disabled buttons | ||
|
||
Disabled buttons have poor contrast and can confuse some users, so avoid them if possible. | ||
|
||
Only use disabled buttons if research shows it makes the user interface easier to understand. | ||
|
||
{{ example({group: 'components', item: 'button', example: 'disabled', html: true, nunjucks: true, open: false}) }} | ||
|
||
## Research on this component | ||
|
||
If you’ve used this component, [get in touch](Anchor link to Get in touch panel at bottom of page) to share your user research findings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
{% from "button/macro.njk" import govukButton %} | ||
|
||
<h3 class="govuk-heading-m">Input button</h3> | ||
|
||
{{ govukButton({ | ||
"text": "Save and continue" | ||
}) }} | ||
|
||
<h3 class="govuk-heading-m">Link button</h3> | ||
|
||
{{ govukButton({ | ||
"text": "Link button", | ||
"href": "#" | ||
}) }} | ||
|
||
<h3 class="govuk-heading-m"><button></h3> | ||
|
||
{{ govukButton({ | ||
"name": "button", | ||
"text": "Save and continue", | ||
"element": "button" | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
{% from "button/macro.njk" import govukButton %} | ||
|
||
<h3 class="govuk-heading-m">Input Start button</h3> | ||
|
||
{{ govukButton({ | ||
"text": "Start now button", | ||
"classes": "govuk-c-button--start" | ||
}) }} | ||
|
||
<h3 class="govuk-heading-m">Link Start button</h3> | ||
|
||
{{ govukButton({ | ||
"text": "Start now link button", | ||
"href": "#", | ||
"classes": "govuk-c-button--start" | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
|
||
{% from 'checkbox/macro.njk' import govukCheckbox %} | ||
|
||
{{ govukCheckbox({ | ||
"idPrefix": "nationality", | ||
"name": "nationality", | ||
"fieldset": { | ||
"legendHtml": '<h1 class="govuk-heading-xl">What is your nationality?</h1>', | ||
"legendHintText": "If you have dual nationality, select all options that are relevant to you." | ||
}, | ||
"items": [ | ||
{ | ||
"value": "british", | ||
"text": "British" | ||
}, | ||
{ | ||
"value": "irish", | ||
"text": "Irish" | ||
}, | ||
{ | ||
"value": "other", | ||
"text": "Citizen of another country" | ||
} | ||
] | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
|
||
<fieldset class="govuk-c-fieldset"> | ||
<legend class="govuk-c-fieldset__legend"> | ||
<h1 class="govuk-heading-xl">What is your address?</h1> | ||
</legend> | ||
|
||
<label class="govuk-c-label" for="address-line-1"> | ||
Building and street <span class="govuk-h-visually-hidden">line 1 of 2</span> | ||
</label> | ||
<input class="govuk-c-input" id="address-line-1" name="address-line-1" type="text"> | ||
|
||
<label class="govuk-c-label govuk-h-visually-hidden" for="address-street"> | ||
Building and street line 2 of 2 | ||
</label> | ||
<input class="govuk-c-input" id="address-line-2" name="address-line-2" type="text"> | ||
|
||
<label class="govuk-c-label" for="address-town"> | ||
Town or city | ||
</label> | ||
<input class="govuk-c-input" id="address-town" name="address-town" type="text"> | ||
|
||
<label class="govuk-c-label" for="address-county"> | ||
County | ||
</label> | ||
<input class="govuk-c-input" id="address-county" name="address-county" type="text"> | ||
|
||
<label class="govuk-c-label" for="address-postcode"> | ||
Postcode | ||
</label> | ||
<input class="govuk-c-input" id="address-postcode" name="address-postcode" type="text"> | ||
</fieldset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
layout: layout-example.njk | ||
--- | ||
|
||
{% from "fieldset/macro.njk" import govukFieldset %} | ||
|
||
{{ govukFieldset({ | ||
"legendHtml": '<h1 class="govuk-heading-xl">Legend text goes here</h1>', | ||
"legendHintText": "Legend hint text goes here" | ||
}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
title: Fieldset | ||
description: Use the Fieldset component to group related form inputs. | ||
section: Components | ||
aliases: | ||
layout: layout-components.njk | ||
--- | ||
|
||
{% from "_example.njk" import example %} | ||
|
||
{{ example({group: 'components', item: 'fieldset', example: 'default'}) }} | ||
|
||
Use the Fieldset component to group related form inputs. | ||
|
||
## When to use this component | ||
|
||
Use the Fieldset component when you need to show a relationship between multiple form inputs. For example, you may need to group a set of text inputs into a single fieldset when [asking for an address](../../patterns/addresses). | ||
|
||
{{ example({group: 'components', item: 'fieldset', example: 'address-group', html: true, nunjucks: true, open: true}) }} | ||
|
||
If you’re using the examples or macros for [Radios](../radios), [Checkboxes](../checkboxes) or [Date input](../date-input), the fieldset will already be included. | ||
|
||
## How it works | ||
|
||
The first element inside a fieldset must be a `legend` which describes the group of inputs. This could be a question, such as ‘What is your current address?’ or a statement like ‘Personal details’. | ||
|
||
{{ example({group: 'components', item: 'fieldset', example: 'default', html: true, nunjucks: true, open: false}) }} | ||
|
||
On [Question pages](../../patterns/question-pages) containing a group of inputs, including the question as the legend helps users of screenreaders to understand that the inputs are all related to that question. | ||
|
||
Include any general help text which is important for filling in the form and can’t be written as [hint text](Link to hint text section of help users Fill in a form) in the legend, but try to keep it as concise as possible. | ||
|
||
## Research on this component | ||
|
||
If you’ve used this component, [get in touch](Anchor link to Get in touch panel at bottom of page) to share your user research findings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.