Component

Inverse header

A wrapper to contain header content in white text

This component can be passed a block of template code and will wrap it in a blue header. This is as light-touch as possible and doesn’t attempt to deal with the margins and paddings of its content. White text is enforced on content and would need to be overridden where unwanted. Implemented to accommodate topic and list page headings but unopinionated about its contents.

If passing links to the block make sure to add the inverse modifier.

Search for usage of this component on GitHub.

How it looks (preview) (preview all)

Education, Training and Skills

How to call this component

<%= render "govuk_publishing_components/components/inverse_header", {
} do %>
  <!-- example content -->
  <%= render "govuk_publishing_components/components/title", {
    title: "Education, Training and Skills",
    inverse: true
  } %>
  <!-- end of example content -->
<% end %>

Accessibility acceptance criteria

The component must:

  • be used in conjunction with content that renders a text contrast ratio higher than 4.5:1 against the header colour to meet WCAG AA.

Other examples

Standard options

This component uses the component wrapper helper. It accepts the following options and applies them to the parent element of the component. See the component wrapper helper documentation for more detail.

  • id - accepts a string for the element ID attribute
  • data_attributes - accepts a hash of data attributes
  • aria - accepts a hash of aria attributes
  • classes - accepts a space separated string of classes, these should not be used for styling and must be prefixed with js-
  • margin_bottom - accepts a number from 0 to 9 (0px to 60px) using the GOV.UK Frontend spacing scale (defaults to no margin)
  • role - accepts a space separated string of roles
  • lang - accepts a language attribute value
  • open - accepts an open attribute value (true or false)
  • hidden - accepts an empty string, ‘hidden’, or ‘until-found’
  • tabindex - accepts an integer. The integer can also be passed as a string.
  • dir - accepts ‘rtl’, ‘ltr’, or ‘auto’.

For full page width (preview)

Used when the header covers the full width of the page, but it’s content is in the grid layout. The left-right padding is removed to make the contents line up with the other items on the page.

Education, Training and Skills

<%= render "govuk_publishing_components/components/inverse_header", {
  full_width: true
} do %>
  <!-- example content -->
  <%= render "govuk_publishing_components/components/title", {
    title: "Education, Training and Skills",
    inverse: true
  } %>
  <!-- end of example content -->
<% end %>

Html publication header (preview)

The inverse header component is used on HTML publications. See example on GOV.UK here

Notice

LN5 0AT, Jackson Homes (Scopwick) Ltd: environmental permit application

Published 22 April 2016

<%= render "govuk_publishing_components/components/inverse_header", {
} do %>
  <!-- example content -->
  <%= render "govuk_publishing_components/components/title", {
    title: "LN5 0AT, Jackson Homes (Scopwick) Ltd: environmental permit application",
    inverse: true,
    context: "Notice",
  } %>
  <p class="publication-header__last-changed">Published 22 April 2016</p>
  <!-- end of example content -->
<% end %>