Skip to content

Commit 983f30e

Browse files
committed
Update component pages for separated params table
1 parent a97e309 commit 983f30e

File tree

33 files changed

+192
-159
lines changed

33 files changed

+192
-159
lines changed

src/components/accordion/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Accordion
33
description: The accordion component lets users show and hide sections of related content on a page
44
section: Components
5+
item: accordion
56
aliases:
67
backlogIssueId: 1
78
layout: layout-pane.njk
@@ -11,7 +12,7 @@ layout: layout-pane.njk
1112

1213
The accordion component lets users show and hide sections of related content on a page.
1314

14-
{{ example({ group: "components", item: "accordion", example: "default", html: true, nunjucks: true, open: false, size: "xl", loading: "eager" }) }}
15+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, size: "xl", loading: "eager" }) }}
1516

1617
## When to use this component
1718

@@ -79,7 +80,7 @@ The heading button includes all of these areas:
7980

8081
For users of screen readers, all the text in the button will be read as a single statement (separated by commas to allow for slight pauses). There’s also some visually hidden content in the heading text to help announce the call-to-action as 'show this section' or 'hide this section'.
8182

82-
{{ example({ group: "components", item: "accordion", example: "default", html: true, nunjucks: true, open: false, size: "xl", titleSuffix: "second" }) }}
83+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, size: "xl", titleSuffix: "second" }) }}
8384

8485
#### Write clear button text
8586

@@ -95,7 +96,7 @@ Only add a summary line if it’s actually needed, as it's likely to make the bu
9596

9697
If you’ve decided that you need the summary line, you must make it as short as possible.
9798

98-
{{ example({ group: "components", item: "accordion", example: "with-summary-section", html: true, nunjucks: true, open: false, size: "xl" }) }}
99+
{{ example({ group: "components", item: item, example: "with-summary-section", html: true, nunjucks: true, open: false, size: "xl" }) }}
99100

100101
#### Structure section headings with the rest of the page
101102

src/components/back-link/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Back link
33
description: Use the back link component to help users go back to the previous page in a multi-page transaction
44
section: Components
5+
item: back-link
56
aliases: return link, back button
67
backlogIssueId: 32
78
layout: layout-pane.njk
@@ -37,7 +38,7 @@ See the full list of [components and patterns affected by WCAG 2.2](/accessibili
3738

3839
Although browsers have a back button, some sites break when you use it - so many users avoid it, instead of losing their progress in a service. Also, not all users are aware of the back button.
3940

40-
{{ example({ group: "components", item: "back-link", example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
41+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
4142

4243
## When to use this component
4344

@@ -76,7 +77,7 @@ Where possible, ensure the back link works even when JavaScript is not available
7677

7778
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](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro.
7879

79-
{{ example({ group: "components", item: "back-link", example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
80+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
8081

8182
Using the default link text ('Back') is ideal for services with a simple journey. For example, [applying for a National Insurance number](https://www.gov.uk/apply-national-insurance-number). Users will only ever go back to the previous page in the service.
8283

@@ -88,4 +89,4 @@ Use the `govuk-back-link--inverse` modifier class to show a white link on a dark
8889

8990
Make sure all users can see the back link – the background colour [must have a contrast ratio of at least 4.5:1](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) with white.
9091

91-
{{ example({ group: "components", item: "back-link", example: "inverse", html: true, nunjucks: true, open: false }) }}
92+
{{ example({ group: "components", item: item, example: "inverse", html: true, nunjucks: true, open: false }) }}

src/components/breadcrumbs/index.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Breadcrumbs
33
description: Help users orientate themselves and navigate pages within a hierarchical structure
44
section: Components
5+
item: breadcrumbs
56
aliases: navigation path, cookie crumb
67
backlogIssueId: 33
78
layout: layout-pane.njk
@@ -34,7 +35,7 @@ See the full list of [components and patterns affected by WCAG 2.2](/accessibili
3435
classes: "app-inset-text"
3536
}) }}
3637

37-
{{ example({ group: "components", item: "breadcrumbs", example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
38+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
3839

3940
## When to use this component
4041

@@ -62,20 +63,20 @@ The breadcrumbs should start with your 'home' page and end with the parent secti
6263

6364
There are 2 ways to use the breadcrumbs component. You can use HTML or, if you are using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk), you can use the Nunjucks macro.
6465

65-
{{ example({ group: "components", item: "breadcrumbs", example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
66+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
6667

6768
### Collapsing breadcrumbs on mobile devices
6869

6970
If you have long breadcrumbs you can configure the component to only show the first and last items on mobile devices.
7071

7172
To do this, add a `govuk-breadcrumbs--collapse-on-mobile` class to the outer `<div>` element of the component HTML. Or if you’re using Nunjucks, add `collapseOnMobile: true` to the Nunjucks macro as shown in this example.
7273

73-
{{ example({ group: "components", item: "breadcrumbs", example: "collapse-mobile", html: true, nunjucks: true, open: false }) }}
74+
{{ example({ group: "components", item: item, example: "collapse-mobile", html: true, nunjucks: true, open: false }) }}
7475

7576
### Breadcrumbs on dark backgrounds
7677

7778
Use the `govuk-breadcrumbs--inverse` modifier class to show white links and arrows on dark backgrounds – for example, in headers, custom components, and patterns with darker backgrounds.
7879

7980
Make sure all users can see the breadcrumbs – the background colour [must have a contrast ratio of at least 4.5:1](https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html) with white.
8081

81-
{{ example({ group: "components", item: "breadcrumbs", example: "inverse", html: true, nunjucks: true, open: false }) }}
82+
{{ example({ group: "components", item: item, example: "inverse", html: true, nunjucks: true, open: false }) }}

src/components/button/index.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Button
33
description: Use the button component to help users carry out an action
44
section: Components
5+
item: button
56
aliases:
67
backlogIssueId: 34
78
layout: layout-pane.njk
@@ -32,7 +33,7 @@ See the full list of [components and patterns affected by WCAG 2.2](/accessibili
3233
classes: "app-inset-text"
3334
}) }}
3435

35-
{{ example({ group: "components", item: "button", example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
36+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
3637

3738
## When to use this component
3839

@@ -73,30 +74,30 @@ Use a default button for the main call to action on a page.
7374

7475
Avoid using multiple default buttons on a single page. Having more than one main call to action reduces their impact, and makes it harder for users to know what to do next.
7576

76-
{{ example({ group: "components", item: "button", example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
77+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
7778

7879
### Start buttons
7980

8081
Use a start button for the main call to action on your service’s [start page](/patterns/start-using-a-service/).
8182
Start buttons do not usually submit form data, so use a link tag instead of a button tag.
8283

83-
{{ example({ group: "components", item: "button", example: "start", html: true, nunjucks: true, open: false }) }}
84+
{{ example({ group: "components", item: item, example: "start", html: true, nunjucks: true, open: false }) }}
8485

8586
### Secondary buttons
8687

8788
Use secondary buttons for secondary calls to action on a page.
8889

8990
Pages with too many calls to action make it hard for users to know what to do next. Before adding lots of secondary buttons, try to simplify the page or break the content down across multiple pages.
9091

91-
{{ example({ group: "components", item: "button", example: "secondary", html: true, nunjucks: true, open: false }) }}
92+
{{ example({ group: "components", item: item, example: "secondary", html: true, nunjucks: true, open: false }) }}
9293

9394
You can also [group default and secondary buttons together](#grouping-buttons).
9495

9596
### Warning buttons
9697

9798
Warning buttons are designed to make users think carefully before they use them. They only work if used very sparingly. Most services should not need one.
9899

99-
{{ example({ group: "components", item: "button", example: "warning", html: true, nunjucks: true, open: false }) }}
100+
{{ example({ group: "components", item: item, example: "warning", html: true, nunjucks: true, open: false }) }}
100101

101102
Only use warning buttons for actions with serious destructive consequences that cannot be easily undone by a user. For example, permanently deleting an account.
102103

@@ -112,25 +113,25 @@ Use the `govuk-button--inverse` modifier class to show white buttons on dark bac
112113

113114
Make sure all users can see the button – the white button and background colour [must have a contrast ratio of at least 3:1](https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html).
114115

115-
{{ example({ group: "components", item: "button", example: "inverse", html: true, nunjucks: true, open: false }) }}
116+
{{ example({ group: "components", item: item, example: "inverse", html: true, nunjucks: true, open: false }) }}
116117

117118
### Disabled buttons
118119

119120
Disabled buttons have poor contrast and can confuse some users, so avoid them if&nbsp;possible.
120121

121122
Only use disabled buttons if research shows it makes the user interface easier to&nbsp;understand.
122123

123-
{{ example({ group: "components", item: "button", example: "disabled", html: true, nunjucks: true, open: false }) }}
124+
{{ example({ group: "components", item: item, example: "disabled", html: true, nunjucks: true, open: false }) }}
124125

125126
### Grouping buttons
126127

127128
Use a button group when two or more buttons are placed together.
128129

129-
{{ example({ group: "components", item: "button", example: "secondary-combo", html: true, nunjucks: true, open: false }) }}
130+
{{ example({ group: "components", item: item, example: "secondary-combo", html: true, nunjucks: true, open: false }) }}
130131

131132
Any links within a button group will automatically align with the buttons.
132133

133-
{{ example({ group: "components", item: "button", example: "button-group", html: true, nunjucks: true, open: false }) }}
134+
{{ example({ group: "components", item: item, example: "button-group", html: true, nunjucks: true, open: false }) }}
134135

135136
### Stop users from accidentally sending information more than once
136137

@@ -148,7 +149,7 @@ If you are working in production and research shows that users are frequently se
148149

149150
To do this, set the `data-prevent-double-click` attribute to `true`. You can do this directly in the HTML or, if you’re using Nunjucks, you can use the Nunjucks macro as shown in this example.
150151

151-
{{ example({ group: "components", item: "button", example: "prevent-double-click", html: true, nunjucks: true, open: false }) }}
152+
{{ example({ group: "components", item: item, example: "prevent-double-click", html: true, nunjucks: true, open: false }) }}
152153

153154
This feature will prevent double clicks for users that have JavaScript enabled, however you should also think about the issue server-side to protect against attacks.
154155

src/components/character-count/index.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Character count
33
description: Tell users how many characters or words they can enter into a textarea
44
section: Components
5+
item: character-count
56
aliases: word count
67
backlogIssueId: 67
78
layout: layout-pane.njk
@@ -11,7 +12,7 @@ layout: layout-pane.njk
1112

1213
Help users know how much text they can enter when there is a limit on the number of characters.
1314

14-
{{ example({ group: "components", item: "character-count", example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
15+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, loading: "eager" }) }}
1516

1617
## When to use this component
1718

@@ -46,21 +47,21 @@ This component uses JavaScript. If JavaScript is not available, users will see a
4647

4748
There are 2 ways to use the character count component. You can use HTML or, if you’re using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.
4849

49-
{{ example({ group: "components", item: "character-count", example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
50+
{{ example({ group: "components", item: item, example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}
5051

5152
### If you’re asking more than one question on the page
5253

5354
If you're asking more than one question on the page, do not set the contents of the `<label>` as the page heading. Read more about [asking multiple questions on question pages](/patterns/question-pages/#asking-multiple-questions-on-a-page).
5455

55-
{{ example({ group: "components", item: "character-count", example: "without-heading", html: true, nunjucks: true, open: false }) }}
56+
{{ example({ group: "components", item: item, example: "without-heading", html: true, nunjucks: true, open: false }) }}
5657

5758
### Consider if a word count is more helpful
5859

5960
In some cases it may be more helpful to show a word count. For example, if your question requires a longer answer.
6061

6162
Do this by setting `data-maxwords` in the component markup. For example, `data-maxwords="150"` will set a word limit of 150.
6263

63-
{{ example({ group: "components", item: "character-count", example: "word-count", html: true, nunjucks: true, open: false }) }}
64+
{{ example({ group: "components", item: item, example: "word-count", html: true, nunjucks: true, open: false }) }}
6465

6566
### Avoid narrow limits
6667

@@ -74,13 +75,13 @@ To do this, set the threshold in the component markup as a percentage. For examp
7475

7576
Screen reader users will hear the character limit when they first interact with a textarea using the threshold option. Sighted users will not see anything until the count message is shown – though you might choose to include the character limit in the hint text.
7677

77-
{{ example({ group: "components", item: "character-count", example: "threshold", html: true, nunjucks: true, open: false }) }}
78+
{{ example({ group: "components", item: item, example: "threshold", html: true, nunjucks: true, open: false }) }}
7879

7980
### Error messages
8081

8182
Error messages should be styled like this:
8283

83-
{{ example({ group: "components", item: "character-count", example: "error", html: true, nunjucks: true, open: false }) }}
84+
{{ example({ group: "components", item: item, example: "error", html: true, nunjucks: true, open: false }) }}
8485

8586
If a user tries to send their response with too many characters, you must show an error message above the field as well as the count message below it.
8687

0 commit comments

Comments
 (0)