Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add small form controls #791

Merged
merged 5 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/components/checkboxes/index.md.njk
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,18 @@ You can add conditionally revealing content to checkboxes, so users only see con

Keep it simple - if you need to add a lot of content, consider showing it on the next page in the process instead.

### Smaller checkboxes

Use standard-sized checkboxes in nearly all cases. However, smaller versions work well on pages where it’s helpful to make them less visually prominent.

For example, on a page of search results, the primary user need is to see the results. Using smaller checkboxes lets users see and change search filters without distracting them from the main content.

{{ example({group: "components", item: "checkboxes", example: "small", html: true, nunjucks: true, open: false, size: "m"}) }}

Small checkboxes can work well on information dense screens in services designed for repeat use, like caseworking systems.

In services like these, the risk that they will not be noticed is lower because users return to the screen multiple times.

### Error messages

Error messages should be styled like this:
Expand Down
37 changes: 37 additions & 0 deletions src/components/checkboxes/small/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: Small checkboxes
layout: layout-example.njk
---

{% from "checkboxes/macro.njk" import govukCheckboxes %}

{{ govukCheckboxes({
idPrefix: "organisation",
name: "organisation",
classes: "govuk-checkboxes--small",
fieldset: {
legend: {
text: "Organisation",
isPageHeading: true,
classes: "govuk-fieldset__legend--m"
}
},
items: [
{
value: "hmrc",
text: "HM Revenue and Customs (HMRC)"
},
{
value: "employment-tribunal",
text: "Employment Tribunal"
},
{
value: "MOD",
text: "Ministry of Defence"
},
{
value: "DfT",
text: "Department for Transport"
}
]
}) }}
12 changes: 12 additions & 0 deletions src/components/radios/index.md.njk
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ Keep it simple. If you need to add a lot of content, consider showing it on the

Do not use this component to add conditionally revealing content to inline radios.

### Smaller radios

Use standard-sized radios in nearly all cases. However, smaller versions work well on pages where it’s helpful to make them less visually prominent.

For example, on a page of search results, the primary user need is to see the results. Using smaller radios lets users see and change search filters without distracting them from the main content.

{{ example({group: "components", item: "radios", example: "small", html: true, nunjucks: true, open: false, size: "m"}) }}

Small radios can work well on information dense screens in services designed for repeat use, like caseworking systems.

In services like these, the risk that they will not be noticed is lower because users return to the screen multiple times.

### Error messages

Error messages should be styled like this:
Expand Down
29 changes: 29 additions & 0 deletions src/components/radios/small/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Small radios
layout: layout-example.njk
---

{% from "radios/macro.njk" import govukRadios %}

{{ govukRadios({
classes: "govuk-radios--small",
idPrefix: "changed-name",
name: "changed-name",
fieldset: {
legend: {
text: "Filter",
isPageHeading: true,
classes: "govuk-fieldset__legend--m"
}
},
items: [
{
value: "month",
text: "Monthly"
},
{
value: "year",
text: "Yearly"
}
]
}) }}