Skip to main content
Sitemap

Masthead

Introduce users to a major section or topic area, product or service

Contents

<div class="x-govuk-masthead">
  <div class="govuk-width-container">
    <nav class="govuk-breadcrumbs" aria-label="Breadcrumb">
      <ol class="govuk-breadcrumbs__list">
        <li class="govuk-breadcrumbs__list-item">
          <a class="govuk-breadcrumbs__link" href="#">Home</a>
        </li>
        <li class="govuk-breadcrumbs__list-item">
          <a class="govuk-breadcrumbs__link" href="#">Education and learning</a>
        </li>
      </ol>
    </nav>
    <div class="govuk-grid-row">
      <div class="govuk-grid-column-two-thirds-from-desktop">
        <h1 class="x-govuk-masthead__title">
          Apprenticeships, 14 to 19 education and training for work
        </h1>
        <p class="x-govuk-masthead__description">
          Includes finding a course, finding an apprenticeship, information for employers
        </p>
      </div>
    </div>
  </div>
</div>
{{ xGovukMasthead({
  breadcrumbs: {
    items: [{
      href: "#",
      text: "Home"
    }, {
      href: "#",
      text: "Education and learning"
    }]
  },
  title: {
    text: "Apprenticeships, 14 to 19 education and training for work"
  },
  description: {
    text: "Includes finding a course, finding an apprenticeship, information for employers"
  }
}) }}

When to use this component

Use the masthead to

  • introduce a major section or topic area
  • give greater emphasis to page headings
  • guide users into specific areas of functionality
  • create visual hierarchy for key landing pages within your service

For example, use it on topic overview pages, category or collection pages, or to introduce a key workflow in your service.

When not to use this component

Do not use the masthead:

  • on every page of your service – reserve it for key landing pages and section introductions
  • as a replacement for standard page headings
  • when a simple page title would be more appropriate
  • on transactional pages where users are completing tasks

How it works

The masthead uses a lighter tint of your service’s brand colour for its background. It works well for internal pages and section introductions, giving clear hierarchy without overwhelming the page content. It can include:

The masthead should appear directly below the header and take up the full width of the page.

You can use HTML or, if you are using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.

Masthead with a dark background

If you need greater visual impact and brand presence, use the masthead with a dark background.

Contents

<div class="x-govuk-masthead x-govuk-masthead--inverse">
  <div class="govuk-width-container">
    <div class="govuk-phase-banner">
      <p class="govuk-phase-banner__content">
        <strong class="govuk-tag govuk-phase-banner__content__tag">
          Beta
        </strong>
        <span class="govuk-phase-banner__text">
          This is a new service – your <a href='#'>feedback (opens in a new tab)</a> will help us to improve it.
        </span>
      </p>
    </div>
    <nav class="govuk-breadcrumbs govuk-breadcrumbs--inverse" aria-label="Breadcrumb">
      <ol class="govuk-breadcrumbs__list">
        <li class="govuk-breadcrumbs__list-item">
          <a class="govuk-breadcrumbs__link" href="#">GOV.UK Services</a>
        </li>
        <li class="govuk-breadcrumbs__list-item" aria-current="page">GOV.UK Pay</li>
      </ol>
    </nav>
    <div class="govuk-grid-row">
      <div class="govuk-grid-column-two-thirds-from-desktop">
        <h1 class="x-govuk-masthead__title">
          The best way to take payments for public services
        </h1>
        <p class="x-govuk-masthead__description">
          GOV.UK Pay has contracts with payment providers so you can take payments quickly and easily. It’s used across central and local government, police and the NHS.
        </p>
        <a href="#" role="button" draggable="false" class="govuk-button govuk-button--inverse govuk-button--start" data-module="govuk-button">
          Find out if you can use GOV.UK Pay
          <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
            <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
          </svg>
        </a>
      </div>
      <div class="govuk-grid-column-one-third-from-desktop">
        <div class="x-govuk-masthead__image">
          <img src="/assets/example-homepage-illustration.png" alt="Payment screen on mobile and dashboard with refund function.">
        </div>
      </div>
    </div>
  </div>
</div>
{{ xGovukMasthead({
  inverse: true,
  phaseBanner: {
    tag: {
      text: "Beta"
    },
    html: "This is a new service – your <a href='#'>feedback (opens in a new tab)</a> will help us to improve it."
  },
  breadcrumbs: {
    items: [{
      href: "#",
      text: "GOV.UK Services"
    }, {
      text: "GOV.UK Pay"
    }]
  },
  title: {
    text: "The best way to take payments for public services"
  },
  description: {
    text: "GOV.UK Pay has contracts with payment providers so you can take payments quickly and easily. It’s used across central and local government, police and the NHS."
  },
  startButton: {
    text: "Find out if you can use GOV.UK Pay",
    href: "#"
  },
  image: {
    src: "/assets/example-homepage-illustration.png",
    alt: "Payment screen on mobile and dashboard with refund function."
  }
}) }}

Use a masthead with a dark background to:

  • introduce users to your service for the first time
  • highlight your service’s core value proposition
  • create visual impact for your product homepage

You can optionally provide a link to the primary call to action such as signing up or reading the instructions on how to get started.

Make sure all users can see content in the masthead – the background colour must have a contrast ratio of at least 4.5:1 with white to meet WCAG 2.2 success criterion 1.4.3 Contrast (minimum), level AA.

To configure the component to use a dark background with white text and links:

  • add a x-govuk-masthead--inverse modifier class to the outer <div> element of the component HTML
  • add the govuk-breadcrumbs--inverse modifier class to the breadcrumb (if you are using one inside the component)
  • add the govuk-button--inverse modifier class to the start button (if you are using one inside the component)

Or if you’re using Nunjucks, add inverse: true to the Nunjucks macro.

Using alongside the service navigation component

If your service uses the service navigation component, place it directly above the masthead and add the govuk-service-navigation--inverse modifier class. This creates a unified header area with the service navigation and masthead appearing as one section.

Contents

<header class="govuk-header" data-module="govuk-header">
  <div class="govuk-header__container govuk-width-container">
    <div class="govuk-header__logo">
      <a href="/" class="govuk-header__link govuk-header__link--homepage">
        <svg
          focusable="false"
          role="img"
          xmlns="http://www.w3.org/2000/svg"
          viewBox="0 0 296 60"
          height="30"
          width="148"
          fill="currentcolor" class="govuk-header__logotype" aria-label="GOV.UK">
          <title>GOV.UK</title>
          <g>
            <circle cx="20" cy="17.6" r="3.7" />
            <circle cx="10.2" cy="23.5" r="3.7" />
            <circle cx="3.7" cy="33.2" r="3.7" />
            <circle cx="31.7" cy="30.6" r="3.7" />
            <circle cx="43.3" cy="17.6" r="3.7" />
            <circle cx="53.2" cy="23.5" r="3.7" />
            <circle cx="59.7" cy="33.2" r="3.7" />
            <circle cx="31.7" cy="30.6" r="3.7" />
            <path d="M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2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,3.4-2.8,1.4-.6,3-1,4.8-1s3.4.4,4.8,1,2.6,1.6,3.4,2.8c1,1.2,1.6,2.6,2.2,4.4.4,1.6.8,3.4.8,5.4v.2ZM177.8,54l-11.8-42h9.4l8,31.4h.2l8-31.4h9.4l-11.8,42h-11.4,0ZM235.4,46.7c1.2,0,2.4-.2,3.4-.6,1-.4,2-.8,2.8-1.6s1.4-1.6,1.8-2.8c.4-1.2.6-2.4.6-4V11.8h8.2v27.2c0,2.4-.4,4.4-1.2,6.2s-2,3.4-3.6,4.8c-1.4,1.4-3.2,2.4-5.4,3-2,.8-4.4,1-6.8,1s-4.8-.4-6.8-1c-2-.8-3.8-1.8-5.4-3-1.6-1.4-2.6-3-3.6-4.8-.8-1.8-1.2-4-1.2-6.2V11.7h8.4v26c0,1.6.2,2.8.6,4,.4,1.2,1,2,1.8,2.8s1.6,1.2,2.8,1.6c1.2.4,2.2.6,3.6.6h0ZM261.4,11.9h8.4v18.2l14.8-18.2h10.4l-14.4,16.8,15.4,25.2h-9.8l-11-18.8-5.4,6v12.8h-8.4V11.9h0ZM206.2,44.2c-3,0-5.4,2.4-5.4,5.4s2.4,5.4,5.4,5.4,5.4-2.4,5.4-5.4-2.4-5.4-5.4-5.4Z" />
        </svg>
        <span class="govuk-header__product-name">Pay</span>
      </a>
    </div>
  </div>
</header>
<div
  class="govuk-service-navigation govuk-service-navigation--inverse"
  data-module="govuk-service-navigation">
  <div class="govuk-width-container">
    <div class="govuk-service-navigation__container">
      <nav aria-label="Menu" class="govuk-service-navigation__wrapper">
        <button type="button" class="govuk-service-navigation__toggle govuk-js-service-navigation-toggle" aria-controls="navigation" hidden>
          Menu
        </button>
        <ul class="govuk-service-navigation__list" id="navigation">
          <li class="govuk-service-navigation__item">
            <a class="govuk-service-navigation__link" href="#">
              Features
            </a>
          </li>
          <li class="govuk-service-navigation__item">
            <a class="govuk-service-navigation__link" href="#">
              Get started
            </a>
          </li>
          <li class="govuk-service-navigation__item">
            <a class="govuk-service-navigation__link" href="#">
              Documentation
            </a>
          </li>
          <li class="govuk-service-navigation__item">
            <a class="govuk-service-navigation__link" href="#">
              Support
            </a>
          </li>
          <li class="govuk-service-navigation__item">
            <a class="govuk-service-navigation__link" href="#">
              Sign in
            </a>
          </li>
        </ul>
      </nav>
    </div>
  </div>
</div>
<div class="x-govuk-masthead x-govuk-masthead--inverse">
  <div class="govuk-width-container">
    <nav class="govuk-breadcrumbs govuk-breadcrumbs--inverse" aria-label="Breadcrumb">
      <ol class="govuk-breadcrumbs__list">
        <li class="govuk-breadcrumbs__list-item">
          <a class="govuk-breadcrumbs__link" href="#">GOV.UK Services</a>
        </li>
        <li class="govuk-breadcrumbs__list-item" aria-current="page">GOV.UK Pay</li>
      </ol>
    </nav>
    <div class="govuk-grid-row">
      <div class="govuk-grid-column-two-thirds-from-desktop">
        <h1 class="x-govuk-masthead__title">
          The best way to take payments for public services
        </h1>
        <p class="x-govuk-masthead__description">
          GOV.UK Pay has contracts with payment providers so you can take payments quickly and easily. It’s used across central and local government, police and the NHS.
        </p>
        <a href="#" role="button" draggable="false" class="govuk-button govuk-button--inverse govuk-button--start" data-module="govuk-button">
          Find out if you can use GOV.UK Pay
          <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
            <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
          </svg>
        </a>
      </div>
      <div class="govuk-grid-column-one-third-from-desktop">
        <div class="x-govuk-masthead__image">
          <img src="/assets/example-homepage-illustration.png" alt="Payment screen on mobile and dashboard with refund function.">
        </div>
      </div>
    </div>
  </div>
</div>
{{ govukHeader({
  productName: "Pay"
}) }}

{{ govukServiceNavigation({
classes: "govuk-service-navigation–inverse",
navigation: [{
text: "Features",
href: "#"
}, {
text: "Get started",
href: "#"
}, {
text: "Documentation",
href: "#"
}, {
text: "Support",
href: "#"
}, {
text: "Sign in",
href: "#"
}]
}) }}

{{ xGovukMasthead({
inverse: true,
breadcrumbs: {
items: [{
href: "#",
text: "GOV.UK Services"
}, {
text: "GOV.UK Pay"
}]
},
title: {
text: "The best way to take payments for public services"
},
description: {
text: "GOV.UK Pay has contracts with payment providers so you can take payments quickly and easily. It’s used across central and local government, police and the NHS."
},
startButton: {
text: "Find out if you can use GOV.UK Pay",
href: "#"
},
image: {
src: "/assets/example-homepage-illustration.png",
alt: "Payment screen on mobile and dashboard with refund function."
}
}) }}

Hiding the image on mobile devices

If you have an image that is decorative and may not add value on smaller screens, you can configure the component to hide it on mobile devices.

To do this, add the x-govuk-masthead__image--hide-on-mobile modifier class to the outer <div> element that surrounds the image. Or if you’re using Nunjucks, add hideOnMobile: true to the Nunjucks macro as shown in this example.

Contents

<div class="x-govuk-masthead x-govuk-masthead--inverse">
  <div class="govuk-width-container">
    <div class="govuk-phase-banner">
      <p class="govuk-phase-banner__content">
        <strong class="govuk-tag govuk-phase-banner__content__tag">
          Beta
        </strong>
        <span class="govuk-phase-banner__text">
          This is a new service – your <a href='#'>feedback (opens in a new tab)</a> will help us to improve it.
        </span>
      </p>
    </div>
    <nav class="govuk-breadcrumbs govuk-breadcrumbs--inverse" aria-label="Breadcrumb">
      <ol class="govuk-breadcrumbs__list">
        <li class="govuk-breadcrumbs__list-item">
          <a class="govuk-breadcrumbs__link" href="#">GOV.UK Services</a>
        </li>
        <li class="govuk-breadcrumbs__list-item" aria-current="page">GOV.UK Pay</li>
      </ol>
    </nav>
    <div class="govuk-grid-row">
      <div class="govuk-grid-column-two-thirds-from-desktop">
        <h1 class="x-govuk-masthead__title">
          The best way to take payments for public services
        </h1>
        <p class="x-govuk-masthead__description">
          GOV.UK Pay has contracts with payment providers so you can take payments quickly and easily. It’s used across central and local government, police and the NHS.
        </p>
        <a href="#" role="button" draggable="false" class="govuk-button govuk-button--inverse govuk-button--start" data-module="govuk-button">
          Find out if you can use GOV.UK Pay
          <svg class="govuk-button__start-icon" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" aria-hidden="true" focusable="false">
            <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
          </svg>
        </a>
      </div>
      <div class="govuk-grid-column-one-third-from-desktop">
        <div class="x-govuk-masthead__image x-govuk-masthead__image--hide-on-mobile">
          <img src="/assets/example-homepage-illustration.png" alt="" role="presentation">
        </div>
      </div>
    </div>
  </div>
</div>
{{ xGovukMasthead({
  inverse: true,
  phaseBanner: {
    tag: {
      text: "Beta"
    },
    html: "This is a new service – your <a href='#'>feedback (opens in a new tab)</a> will help us to improve it."
  },
  breadcrumbs: {
    items: [{
      href: "#",
      text: "GOV.UK Services"
    }, {
      text: "GOV.UK Pay"
    }]
  },
  title: {
    text: "The best way to take payments for public services"
  },
  description: {
    text: "GOV.UK Pay has contracts with payment providers so you can take payments quickly and easily. It’s used across central and local government, police and the NHS."
  },
  startButton: {
    text: "Find out if you can use GOV.UK Pay",
    href: "#"
  },
  image: {
    src: "/assets/example-homepage-illustration.png",
    hideOnMobile: true
  }
}) }}

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.

Name Type Description
inverse boolean

Use the masthead with a dark background. Defaults to false

title object

Title text shown in the masthead. See title.

description object

Short description text shown below the title. See description.

startButton object

Options for start button. See startButton.

image object

Options for image displayed on the right of the masthead on desktop layouts. See image.

phaseBanner object

Options for the phase banner component. See phase banner component in the GOV.UK Design System.

breadcrumbs object

Options for the breadcrumbs component. See breadcrumbs component in the GOV.UK Design System.

caller nunjucks-block

Not strictly a parameter but Nunjucks code convention. Using a call block enables you to call a macro with all the text inside the tag. This is helpful if you want to pass a lot of content into a macro. To use it, you will need to wrap the entire masthead component in a call block. Content called this way appears between the breadcrumbs (if present) and the title.

classes string Classes to add to the masthead container.
attributes object HTML attributes (for example data attributes) to add to the navigation container.
Options for title
Name Type Description
text string

The title text that displays in the masthead. You can use any string with this option. If you set title.html, this option is not required and is ignored.

html string

The title HTML that displays in the masthead. You can use any string with this option. Use this option to set text that contains HTML. If you set title.html, the title.text option is ignored.

Options for description
Name Type Description
text string

The description text that displays in the masthead. You can use any string with this option. If you set description.html, this option is not required and is ignored.

html string

The description HTML that displays in the masthead. You can use any string with this option. Use this option to set text that contains HTML. If you set description.html, the description.text option is ignored.

Options for startButton
Name Type Description
text string

Required. If startButton.html is set, this is not required. Text for the button or link. If html is provided, the text argument will be ignored and element will be automatically set to button unless href is also set, or it has already been defined. This argument has no effect if element is set to input.

html string

Required. If startButton.text is set, this is not required. HTML for the button or link. If startButton.html is provided, the text argument will be ignored and element will be automatically set to button unless href is also set, or it has already been defined. This argument has no effect if element is set to input.

name string

Name for the button. This has no effect on a elements.

type string

Type of buttonbutton, submit or reset. Defaults to submit. This has no effect on a elements.

href string

The URL that the button should link to. If this is set, element will be automatically set to a.

classes string Classes to add to the button component.
attributes object HTML attributes (for example data attributes) to add to the button component.
Options for image
Name Type Description
src string

Required. URL for the masthead image.

alt string Alternative text for masthead image.
hideOnMobile boolean When true, the image is hidden on tablet breakpoint and below.

Research on this component

This component is based on the Masthead component used in the Product Page Example. This in turn was based on the product pages for:

Versions of this component are currently being used on these services:

Known issues

It’s currently not possible to place this component within the main element when using the default Nunjucks template. If you are able to update your application’s layout, you should adjust it so that the main element encapsulates this component.