Big number
A big number, with a label if needed, for visualising quantitative values such as the number of government departments or historical prime ministers.
This component requires at least a non-falsey number
attribute value passed to it, otherwise it will not render.
How it looks (preview) (preview all)
How to call this component
<%= render "govuk_publishing_components/components/big_number", {
number: 119
} %>
Accessibility acceptance criteria
This component must:
- communicate number value and label (if present) in a single dictation when read with a screen reader
- convey the meaning of the number shown
Links in the component must:
- accept focus
- be focusable with a keyboard
- be usable with a keyboard
- indicate when they have focus
- change in appearance when touched (in the touch-down state)
- change in appearance when hovered
- be usable with touch
- be usable with voice commands
- have visible text
- have meaningful text
Other examples
With labels (preview)
Labels for numbers are given inline styling but stacked using pseudo elements with display block. This is to bypass an issue with NVDA where block level elements are dictated separately.
<%= render "govuk_publishing_components/components/big_number", {
number: 119,
label: "Open consultations"
} %>
With plus symbol (preview)
In some cases, we want to communicate more than just the flat numeric value eg: 400+
. This is why we allow values to be passed as flat strings.
<%= render "govuk_publishing_components/components/big_number", {
number: "400+",
label: "Other agencies and public bodies"
} %>
With percentage symbol (preview)
In some cases, we want to communicate more than just the flat numeric value eg: 90%
. This is why we allow values to be passed as flat strings.
<%= render "govuk_publishing_components/components/big_number", {
number: "90%",
label: "is a large percentage of something"
} %>
With negative symbol (preview)
In some cases, we want to communicate more than just the flat numeric value eg: -20
. This is why we allow values to be passed as flat strings.
<%= render "govuk_publishing_components/components/big_number", {
number: "-20",
label: "is a negative number"
} %>
With unit symbol (preview)
In some cases, we want to communicate more than just the flat numeric value eg: 1M
. This is why we allow values to be passed as flat strings.
<%= render "govuk_publishing_components/components/big_number", {
number: "1M",
label: "is a shorter way of saying one million"
} %>
With link (preview)
<%= render "govuk_publishing_components/components/big_number", {
number: 23,
label: "Ministerial departments",
href: "/government/organisations#ministerial_departments"
} %>
With link but no label (preview)
Numbers that are links are underlined unless a label is provided, in which case the label is given the underline.
<%= render "govuk_publishing_components/components/big_number", {
number: 23,
href: "/government/organisations#ministerial_departments"
} %>
With data attributes (preview)
If a href
attribute is present, data_attributes
will apply to the span
containing the number value (see below).
Note that the component does not include built in tracking. If this is required consider using the GA4 link tracker.
<%= render "govuk_publishing_components/components/big_number", {
number: 23,
label: "Ministerial departments",
href: "/government/organisations#ministerial_departments",
data_attributes: {
"department-count": true
}
} %>
With data attributes but no link (preview)
<%= render "govuk_publishing_components/components/big_number", {
number: 23,
label: "Ministerial departments",
data_attributes: {
"department-count": true
}
} %>
With aria attributes (preview)
Aria attributes are applied to the whole component instance
<%= render "govuk_publishing_components/components/big_number", {
number: 23,
label: "Ministerial departments",
aria: {
hidden: true
}
} %>
With bottom margin (preview)
The component accepts a number for margin bottom from 0
to 9
(0px
to 60px
) using the GOV.UK Frontend spacing scale. The default big number margin bottom is 15px
(govuk-spacing(3)
).
<%= render "govuk_publishing_components/components/big_number", {
number: 119,
label: "Open consultations",
margin_bottom: 9
} %>