Components

Summary list

Use the summary list to summarise information, for example, a user’s responses at the end of a form.

<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">
      Sarah Philips
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> name</span>
      </a>
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Date of birth
    </dt>
    <dd class="govuk-summary-list__value">
      5 January 1978
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> date of birth</span>
      </a>
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact information
    </dt>
    <dd class="govuk-summary-list__value">
      72 Guild Street
      <br>London
      <br>SE23 6FH
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> contact information</span>
      </a>
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact details
    </dt>
    <dd class="govuk-summary-list__value">
      <p class="govuk-body">07700 900457</p>
      <p class="govuk-body">sarah.phillips@example.com</p>
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> contact details</span>
      </a>
    </dd>
  </div>
</dl>
Nunjucks macro options

Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.

Some options are required for the macro to work; these are marked as "Required" in the option description.

If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.

Primary options
Name Type Description
rows array Required. Array of row item objects See rows.
classes string Classes to add to the container.
attributes object HTML attributes (for example data attributes) to add to the container.
Options for rows
Name Type Description
key.text string Required. If html is set, this is not required. Text to use within the each key. If html is provided, the text argument will be ignored.
key.html string Required.
key.classes string Classes to add to the key wrapper
value.text string Required. If html is set, this is not required. Text to use within the each value. If html is provided, the text argument will be ignored.
value.html string Required. If text is set, this is not required. HTML to use within the each value. If html is provided, the text argument will be ignored.
value.classes string Classes to add to the value wrapper
actions.items array Array of action item objects See actions.items.
Options for actions.items
Name Type Description
classes string Classes to add to the actions wrapper
href string Required. The value of the link href attribute for an action item
text string Required. If html is set, this is not required. Text to use within each action item. If html is provided, the text argument will be ignored.
html string Required. If text is set, this is not required. HTML to use within the each action item. If html is provided, the text argument will be ignored.
visuallyHiddenText string Actions rely on context from the surrounding content so may require additional accessible text, text supplied to this option is appended to the end, use html for more complicated scenarios.
{% from "summary-list/macro.njk" import govukSummaryList %}

{{ govukSummaryList({
  rows: [
    {
      key: {
        text: "Name"
      },
      value: {
        text: "Sarah Philips"
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "name"
          }
        ]
      }
    },
    {
      key: {
        text: "Date of birth"
      },
      value: {
        text: "5 January 1978"
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "date of birth"
          }
        ]
      }
    },
    {
      key: {
        text: "Contact information"
      },
      value: {
        html: "72 Guild Street<br>London<br>SE23 6FH"
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "contact information"
          }
        ]
      }
    },
    {
      key: {
        text: "Contact details"
      },
      value: {
        html: '<p class="govuk-body">07700 900457</p><p class="govuk-body">sarah.phillips@example.com</p>'
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "contact details"
          }
        ]
      }
    }
  ]
}) }}

When to use this component

Use the summary list component to present pairs of related information, known as key-value pairs, in a list. The key is a description or label of a piece of information, like ‘Name’, and the value is the piece of information itself, like ‘John Smith’.

You can use it to display metadata like ‘Last updated’ with a date like ‘22 June 2018’. Or to summarise a user’s responses at the end of a form like the check answers pattern.

When not to use this component

The summary list uses the description list (<dl>) HTML element, so only use it to present information that has a key and at least one value.

Do not use it for tabular data or a simple list of information or tasks, like a task list. For those use a <table>, <ul> or <ol>.

How it works

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

Summary list with actions

You can add actions to a summary list, like a ‘Change’ link to let users go back and edit their answer.

For sighted users, the actions get their context from the other content in the row they appear in.

Assistive technology users, like those who use a screen reader, may hear the links out of context and not know what they do. To give more context, add visually hidden text to the links. This means a screen reader user will hear a meaningful action, like ‘Change name’ or ‘Change date of birth’.

<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">
      Sarah Philips
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> name</span>
      </a>
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Date of birth
    </dt>
    <dd class="govuk-summary-list__value">
      5 January 1978
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> date of birth</span>
      </a>
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact information
    </dt>
    <dd class="govuk-summary-list__value">
      72 Guild Street
      <br>London
      <br>SE23 6FH
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> contact information</span>
      </a>
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact details
    </dt>
    <dd class="govuk-summary-list__value">
      <p class="govuk-body">07700 900457</p>
      <p class="govuk-body">sarah.phillips@example.com</p>
    </dd>
    <dd class="govuk-summary-list__actions">
      <a class="govuk-link" href="#">
        Change
        <span class="govuk-visually-hidden"> contact details</span>
      </a>
    </dd>
  </div>
</dl>
Nunjucks macro options

Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.

Some options are required for the macro to work; these are marked as "Required" in the option description.

If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.

Primary options
Name Type Description
rows array Required. Array of row item objects See rows.
classes string Classes to add to the container.
attributes object HTML attributes (for example data attributes) to add to the container.
Options for rows
Name Type Description
key.text string Required. If html is set, this is not required. Text to use within the each key. If html is provided, the text argument will be ignored.
key.html string Required.
key.classes string Classes to add to the key wrapper
value.text string Required. If html is set, this is not required. Text to use within the each value. If html is provided, the text argument will be ignored.
value.html string Required. If text is set, this is not required. HTML to use within the each value. If html is provided, the text argument will be ignored.
value.classes string Classes to add to the value wrapper
actions.items array Array of action item objects See actions.items.
Options for actions.items
Name Type Description
classes string Classes to add to the actions wrapper
href string Required. The value of the link href attribute for an action item
text string Required. If html is set, this is not required. Text to use within each action item. If html is provided, the text argument will be ignored.
html string Required. If text is set, this is not required. HTML to use within the each action item. If html is provided, the text argument will be ignored.
visuallyHiddenText string Actions rely on context from the surrounding content so may require additional accessible text, text supplied to this option is appended to the end, use html for more complicated scenarios.
{% from "summary-list/macro.njk" import govukSummaryList %}

{{ govukSummaryList({
  rows: [
    {
      key: {
        text: "Name"
      },
      value: {
        text: "Sarah Philips"
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "name"
          }
        ]
      }
    },
    {
      key: {
        text: "Date of birth"
      },
      value: {
        text: "5 January 1978"
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "date of birth"
          }
        ]
      }
    },
    {
      key: {
        text: "Contact information"
      },
      value: {
        html: "72 Guild Street<br>London<br>SE23 6FH"
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "contact information"
          }
        ]
      }
    },
    {
      key: {
        text: "Contact details"
      },
      value: {
        html: '<p class="govuk-body">07700 900457</p><p class="govuk-body">sarah.phillips@example.com</p>'
      },
      actions: {
        items: [
          {
            href: "#",
            text: "Change",
            visuallyHiddenText: "contact details"
          }
        ]
      }
    }
  ]
}) }}

Summary list without actions

<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">
      Sarah Philips
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Date of birth
    </dt>
    <dd class="govuk-summary-list__value">
      5 January 1978
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact information
    </dt>
    <dd class="govuk-summary-list__value">
      72 Guild Street
      <br>London
      <br>SE23 6FH
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact details
    </dt>
    <dd class="govuk-summary-list__value">
      <p class="govuk-body">07700 900457</p>
      <p class="govuk-body">sarah.phillips@example.com</p>
    </dd>
  </div>
</dl>
Nunjucks macro options

Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.

Some options are required for the macro to work; these are marked as "Required" in the option description.

If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.

Primary options
Name Type Description
rows array Required. Array of row item objects See rows.
classes string Classes to add to the container.
attributes object HTML attributes (for example data attributes) to add to the container.
Options for rows
Name Type Description
key.text string Required. If html is set, this is not required. Text to use within the each key. If html is provided, the text argument will be ignored.
key.html string Required.
key.classes string Classes to add to the key wrapper
value.text string Required. If html is set, this is not required. Text to use within the each value. If html is provided, the text argument will be ignored.
value.html string Required. If text is set, this is not required. HTML to use within the each value. If html is provided, the text argument will be ignored.
value.classes string Classes to add to the value wrapper
actions.items array Array of action item objects See actions.items.
Options for actions.items
Name Type Description
classes string Classes to add to the actions wrapper
href string Required. The value of the link href attribute for an action item
text string Required. If html is set, this is not required. Text to use within each action item. If html is provided, the text argument will be ignored.
html string Required. If text is set, this is not required. HTML to use within the each action item. If html is provided, the text argument will be ignored.
visuallyHiddenText string Actions rely on context from the surrounding content so may require additional accessible text, text supplied to this option is appended to the end, use html for more complicated scenarios.
{% from "summary-list/macro.njk" import govukSummaryList %}

{{ govukSummaryList({
  rows: [
    {
      key: {
        text: "Name"
      },
      value: {
        text: "Sarah Philips"
      }
    },
    {
      key: {
        text: "Date of birth"
      },
      value: {
        text: "5 January 1978"
      }
    },
    {
      key: {
        text: "Contact information"
      },
      value: {
        html: "72 Guild Street<br>London<br>SE23 6FH"
      }
    },
    {
      key: {
        text: "Contact details"
      },
      value: {
        html: '<p class="govuk-body">07700 900457</p><p class="govuk-body">sarah.phillips@example.com</p>'
      }
    }
  ]
}) }}

Summary list without borders

If you do not include actions in your summary list and it would be better for your design to remove the separating borders, use the govuk-summary-list--no-border class.

<dl class="govuk-summary-list govuk-summary-list--no-border">
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Name
    </dt>
    <dd class="govuk-summary-list__value">
      Sarah Philips
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Date of birth
    </dt>
    <dd class="govuk-summary-list__value">
      5 January 1978
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact information
    </dt>
    <dd class="govuk-summary-list__value">
      72 Guild Street
      <br>London
      <br>SE23 6FH
    </dd>
  </div>
  <div class="govuk-summary-list__row">
    <dt class="govuk-summary-list__key">
      Contact details
    </dt>
    <dd class="govuk-summary-list__value">
      <p class="govuk-body">07700 900457</p>
      <p class="govuk-body">sarah.phillips@example.com</p>
    </dd>
  </div>
</dl>
Nunjucks macro options

Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.

Some options are required for the macro to work; these are marked as "Required" in the option description.

If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.

Primary options
Name Type Description
rows array Required. Array of row item objects See rows.
classes string Classes to add to the container.
attributes object HTML attributes (for example data attributes) to add to the container.
Options for rows
Name Type Description
key.text string Required. If html is set, this is not required. Text to use within the each key. If html is provided, the text argument will be ignored.
key.html string Required.
key.classes string Classes to add to the key wrapper
value.text string Required. If html is set, this is not required. Text to use within the each value. If html is provided, the text argument will be ignored.
value.html string Required. If text is set, this is not required. HTML to use within the each value. If html is provided, the text argument will be ignored.
value.classes string Classes to add to the value wrapper
actions.items array Array of action item objects See actions.items.
Options for actions.items
Name Type Description
classes string Classes to add to the actions wrapper
href string Required. The value of the link href attribute for an action item
text string Required. If html is set, this is not required. Text to use within each action item. If html is provided, the text argument will be ignored.
html string Required. If text is set, this is not required. HTML to use within the each action item. If html is provided, the text argument will be ignored.
visuallyHiddenText string Actions rely on context from the surrounding content so may require additional accessible text, text supplied to this option is appended to the end, use html for more complicated scenarios.
{% from "summary-list/macro.njk" import govukSummaryList %}

{{ govukSummaryList({
  classes: 'govuk-summary-list--no-border',
  rows: [
    {
      key: {
        text: "Name"
      },
      value: {
        text: "Sarah Philips"
      }
    },
    {
      key: {
        text: "Date of birth"
      },
      value: {
        text: "5 January 1978"
      }
    },
    {
      key: {
        text: "Contact information"
      },
      value: {
        html: "72 Guild Street<br>London<br>SE23 6FH"
      }
    },
    {
      key: {
        text: "Contact details"
      },
      value: {
        html: '<p class="govuk-body">07700 900457</p><p class="govuk-body">sarah.phillips@example.com</p>'
      }
    }
  ]
}) }}

Research on this component

This component was developed and tested by the Government Digital Services as part of the check answers pattern.

Next steps

More research is needed to find out how well this component works outside the check answers pattern, for example, to present summaries within caseworking systems.

If you use this component in your service, get in touch to share your research findings.

Get in touch

If you’ve got a question, idea or suggestion share it in #govuk-design-system on cross-government Slack (open in app) or email the Design System team on govuk-design-system-support@digital.cabinet-office.gov.uk

Discuss ‘Summary list’ on GitHub