Skip to main content Skip to list of components
Service phase: Beta

This is a new service – give us your feedback to help improve it.

Components

Warning

The warning component provides the user with important information about the page or article.

Contents

  1. Component status
Open this example in new tab

HTML

<div class="tna-warning">
  <h2 class="tna-warning__heading">
    <span class="tna-visually-hidden">Important information</span><span class="tna-warning__heading-icon" aria-hidden="true">!</span>
  </h2>
  <div class="tna-warning__body">
    Please note this page references hunger strikes and force feeding, which some people may find upsetting.
  </div>
</div>

Nunjucks

Nunjucks options
Primary options
Name Type Description
heading string

If set, the visually hidden heading for the warning which will be suffixed with an exclamation mark.

Default value: Important information

headingLevel number

Required.

The heading level which represents an element from <h1> through to <h6>.

body string

Required.

The body text of the warning.

classes string

Classes to add to the warning.

attributes object

HTML attributes (for example data attributes) to add to the warning.

{% from "nationalarchives/components/warning/macro.njk" import tnaWarning %}

{{ tnaWarning({
  headingLevel: 2,
  body: "Please note this page references hunger strikes and force feeding, which some people may find upsetting."
}) }}
Phase
Ready for production
Tested without CSS
Yes
Passed DAC audit
Yes
Documentation complete
No

Back to top