Skip to main content
Preview This is a design system preview environment for main branch

Internal review app NHS.UK frontend

Use design system guidance and examples to build consistent, accessible NHS services for the public and staff.

Error summary

These examples are used for automated tests and may not follow service manual best practice.

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) }}

There is a problem

Describe the errors and how to correct them

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <p>
        Describe the errors and how to correct them
      </p>
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  description: {
    text: "Describe the errors and how to correct them"
  },
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) }}

There is a problem

Describe the errors and how to correct them

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <p>
        Describe the errors and how to correct them
      </p>
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  description: "Describe the errors and how to correct them",
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) }}

There is a problem

Describe the errors and how to correct them

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <p>
        Describe the errors and <span>how to correct them</span>
      </p>
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  description: {
    html: "Describe the errors and <span>how to correct them</span>"
  },
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) }}

There is a problem

Describe the errors and how to correct them

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <p>
        Describe the errors and how to correct them
      </p>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  description: {
    text: "Describe the errors and how to correct them"
  }
}) }}

There is a problem

Describe the errors and how to correct them

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <p>
        Describe the errors and <span>how to correct them</span>
      </p>
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{% call errorSummary({
  heading: {
    text: "There is a problem"
  },
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) -%}
Describe the errors and <span>how to correct them</span>
{%- endcall %}
Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: "There is a problem",
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) }}
Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a <span>problem</span>
    </h2>
    <div class="nhsuk-error-summary__body">
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-day">Date of birth must be in the past</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    html: "There is a <span>problem</span>"
  },
  errorList: [
    {
      text: "Date of birth must be in the past",
      href: "#example-day"
    }
  ]
}) }}
Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-first-name">Enter your first name</a>
        </li>
        <li>
          <a href="#example-last-name">Enter your last name</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  errorList: [
    {
      text: "Enter your first name",
      href: "#example-first-name"
    },
    {
      text: "Enter your last name",
      href: "#example-last-name"
    }
  ]
}) }}

There is a problem

Code

Markup

<div class="nhsuk-error-summary" data-module="nhsuk-error-summary">
  <div role="alert">
    <h2 class="nhsuk-error-summary__heading">
      There is a problem
    </h2>
    <div class="nhsuk-error-summary__body">
      <ul class="nhsuk-list nhsuk-error-summary__list">
        <li>
          <a href="#example-first-name">Enter your first name</a>
        </li>
      </ul>
    </div>
  </div>
</div>

Macro

{% from "error-summary/macro.njk" import errorSummary -%}

{{ errorSummary({
  heading: {
    text: "There is a problem"
  },
  errorList: [
    {
      text: "Enter your first name",
      href: "#example-first-name"
    },
    false
  ]
}) }}