Summary list Use the summary list to summarise information, such as a user’s
responses at the end of a form.
Summary lists contain one or more rows with keys and values. Rows can
optionally contain actions which are links to other pages.
The keys and values can either be set using the text
argument or by
passing a block of HTML.
Actions need text
to set the link text and href
for the link target.
When the same action text is used multiple times, like ‘Change’ in the
example below, we can provide the visually_hidden_text
argument to
describe what we’re changing.
The summary list expects rows to have actions, rows without actions
will automatically have the class govuk-summary-list__row--no-actions
applied to maintain consistent alignment.
The visually hidden text will be rendered immediately after the link.
Output
Baboon
Monkeys of the genus Papio
Dugong
Dugongs are a species of sea cow
<dl class= "govuk-summary-list" >
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Aardvark
</dt>
<dd class= "govuk-summary-list__value" >
The aardvark is vaguely pig-like in appearance
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
aardvarks
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Baboon
</dt>
<dd class= "govuk-summary-list__value" >
Monkeys of the genus Papio
</dd>
<dd class= "govuk-summary-list__actions" >
<ul class= "govuk-summary-list__actions-list" >
<li class= "govuk-summary-list__actions-list-item" >
<a class= "govuk-link" href= "#" >
Email<span class= "govuk-visually-hidden" >
baboons
</span>
</a>
</li>
<li class= "govuk-summary-list__actions-list-item" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
baboons
</span>
</a>
</li>
</ul>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Chinchilla
</dt>
<dd class= "govuk-summary-list__value" >
Either of two species of crepuscular rodents
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
chinchillas
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row govuk-summary-list__row--no-actions" >
<dt class= "govuk-summary-list__key" >
Dugong
</dt>
<dd class= "govuk-summary-list__value" >
Dugongs are a species of sea cow
</dd>
</div>
</dl>
When there are no user actions and the summary list is only used to
display static information, the actions column can be hidden entirely
using actions: false
. Doing this makes the values column wider
consuming the remaining space.
Output
Name
Sherlock Holmes
Address
221B Baker Street, Westminster, London, NW1 6XE, England
Phone number
020 123 1234
<dl class= "govuk-summary-list" >
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Name
</dt>
<dd class= "govuk-summary-list__value" >
Sherlock Holmes
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Address
</dt>
<dd class= "govuk-summary-list__value" >
221B Baker Street, Westminster, London, NW1 6XE, England
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Phone number
</dt>
<dd class= "govuk-summary-list__value" >
020 123 1234
</dd>
</div>
</dl>
If a row has missing information, include a link to add the information
within the value column instead of as an action.
When there is no link fallback text will be used. By default it’s
a blank string but can be overridden by configuring
the default_summary_list_value_text
.
Summary lists can also be generated by passing an array of hashes to
rows:
.
The format matches the Nunjucks macros except for setting key and
value contents using the html
argument. Use blocks directly for custom
HTML.
Output
Name
Hercule Poirot
Address
Flat 203, 56B Whitehaven Mansions, Charterhouse Square, London
Change
address
<dl class= "govuk-summary-list" >
<div class= "govuk-summary-list__row govuk-summary-list__row--no-actions" >
<dt class= "govuk-summary-list__key" >
Name
</dt>
<dd class= "govuk-summary-list__value" >
Hercule Poirot
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Address
</dt>
<dd class= "govuk-summary-list__value" >
Flat 203, 56B Whitehaven Mansions, Charterhouse Square, London
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
address
</span>
</a>
</dd>
</div>
</dl>
If you’re showing multiple summary lists on a page, you can show each list
within a summary card. This lets you visually separate each summary list
and give each a title and some actions.
Use summary cards when you need to show:
multiple summary lists that all describe the same type of thing, such as people
actions that will apply to all the items in a list
Input
{
araquanid_data: [
{ key: { text: "Type" }, value: { text: "💧 Water" } },
{
key: { text: "Description" },
value: { text: "Araquanid is an arachnoid Pokémon with a water bubble around its head." },
actions: [{ href: "#" , visually_hidden_text: "Araquanid's description" }],
},
{
key: { text: "Attack" },
value: { text: "70" },
actions: [{ href: "#" , visually_hidden_text: "Araquanid's attack statistics" }],
},
{
key: { text: "Defence" },
value: { text: "92" },
actions: [{ href: "#" , visually_hidden_text: "Araquanid's defence statistics" }],
},
{
key: { text: "Speed" },
value: { text: "42" },
actions: [{ href: "#" , visually_hidden_text: "Araquanid's speed" }],
}
],
emboar_actions: [
govuk_link_to ( "Status" , "#" ),
govuk_link_to ( "Choose" , "#" )
],
emboar_data: [
{ key: { text: "Type" }, value: { text: "🔥 Fire" } },
{
key: { text: "Description" },
value: { text: "Emboar is a bulky, bipedal Pokémon with pig-like features." },
actions: [{ href: "#" , visually_hidden_text: "Emboar's description" }],
},
{
key: { text: "Attack" },
value: { text: "123" },
actions: [{ href: "#" , visually_hidden_text: "Emboar's attack statistics" }],
},
{
key: { text: "Defence" },
value: { text: "65" },
actions: [{ href: "#" , visually_hidden_text: "Emboar's defence statistics" }],
},
{
key: { text: "Speed" },
value: { text: "65" },
actions: [{ href: "#" , visually_hidden_text: "Emboar's speed" }],
}
]
}
Output
<div class= "govuk-summary-card" >
<div class= "govuk-summary-card__title-wrapper" >
<h2 class= "govuk-summary-card__title" >
Araquanid
</h2>
<ul class= "govuk-summary-card__actions" >
<li class= "govuk-summary-card__action" >
<a class= "govuk-link" href= "#" >
Status
</a>
<span class= "govuk-visually-hidden" >
(Araquanid)
</span>
</li>
<li class= "govuk-summary-card__action" >
<a class= "govuk-link" href= "#" >
Choose
</a>
<span class= "govuk-visually-hidden" >
(Araquanid)
</span>
</li>
</ul>
</div>
<div class= "govuk-summary-card__content" >
<dl class= "govuk-summary-list" >
<div class= "govuk-summary-list__row govuk-summary-list__row--no-actions" >
<dt class= "govuk-summary-list__key" >
Type
</dt>
<dd class= "govuk-summary-list__value" >
💧 Water
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Description
</dt>
<dd class= "govuk-summary-list__value" >
Araquanid is an arachnoid Pokémon with a water bubble around its head.
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Araquanid's description
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Attack
</dt>
<dd class= "govuk-summary-list__value" >
70
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Araquanid's attack statistics
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Defence
</dt>
<dd class= "govuk-summary-list__value" >
92
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Araquanid's defence statistics
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Speed
</dt>
<dd class= "govuk-summary-list__value" >
42
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Araquanid's speed
</span>
</a>
</dd>
</div>
</dl>
</div>
</div>
<div class= "govuk-summary-card" >
<div class= "govuk-summary-card__title-wrapper" >
<h2 class= "govuk-summary-card__title" >
Emboar
</h2>
<ul class= "govuk-summary-card__actions" >
<li class= "govuk-summary-card__action" >
<a class= "govuk-link" href= "#" >
Status
</a>
<span class= "govuk-visually-hidden" >
(Emboar)
</span>
</li>
<li class= "govuk-summary-card__action" >
<a class= "govuk-link" href= "#" >
Choose
</a>
<span class= "govuk-visually-hidden" >
(Emboar)
</span>
</li>
</ul>
</div>
<div class= "govuk-summary-card__content" >
<dl class= "govuk-summary-list" >
<div class= "govuk-summary-list__row govuk-summary-list__row--no-actions" >
<dt class= "govuk-summary-list__key" >
Type
</dt>
<dd class= "govuk-summary-list__value" >
🔥 Fire
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Description
</dt>
<dd class= "govuk-summary-list__value" >
Emboar is a bulky, bipedal Pokémon with pig-like features.
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Emboar's description (Emboar)
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Attack
</dt>
<dd class= "govuk-summary-list__value" >
123
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Emboar's attack statistics (Emboar)
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Defence
</dt>
<dd class= "govuk-summary-list__value" >
65
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Emboar's defence statistics (Emboar)
</span>
</a>
</dd>
</div>
<div class= "govuk-summary-list__row" >
<dt class= "govuk-summary-list__key" >
Speed
</dt>
<dd class= "govuk-summary-list__value" >
65
</dd>
<dd class= "govuk-summary-list__actions" >
<a class= "govuk-link" href= "#" >
Change<span class= "govuk-visually-hidden" >
Emboar's speed (Emboar)
</span>
</a>
</dd>
</div>
</dl>
</div>
</div>
Arbitrary HTML content can be passed into the govuk_summary_card
block and it will
render in the place of a summary list.