Legend
These examples are used for automated tests and may not follow service manual best practice.
Legend default
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend size class
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend size class overriding size option
Open this example in a new tab: Legend size class overriding size option
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with size S text
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with size M text
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with size L text
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with size XL text
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--xl">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with size S text and caption
Open this example in a new tab: Legend with size S text and caption
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
<span class="nhsuk-caption">
About you
</span>
What is your home address?
</legend>
Macro
Legend with size M text and caption
Open this example in a new tab: Legend with size M text and caption
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
<span class="nhsuk-caption-m">
About you
</span>
What is your home address?
</legend>
Macro
Legend with size L text and caption
Open this example in a new tab: Legend with size L text and caption
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<span class="nhsuk-caption-l">
About you
</span>
What is your home address?
</legend>
Macro
Legend with size XL text and caption
Open this example in a new tab: Legend with size XL text and caption
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--xl">
<span class="nhsuk-caption-xl">
About you
</span>
What is your home address?
</legend>
Macro
Legend with size S text and caption "after" as a paragraph
Open this example in a new tab: Legend with size S text and caption "after" as a paragraph
About you
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
What is your home address?
</legend>
<p class="nhsuk-caption nhsuk-caption--bottom">
About you
</p>
Macro
Legend with size M text and caption "after" as a paragraph
Open this example in a new tab: Legend with size M text and caption "after" as a paragraph
About you
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
What is your home address?
</legend>
<p class="nhsuk-caption-m nhsuk-caption--bottom">
About you
</p>
Macro
Legend with size L text and caption "after" as a paragraph
Open this example in a new tab: Legend with size L text and caption "after" as a paragraph
About you
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
What is your home address?
</legend>
<p class="nhsuk-caption-l nhsuk-caption--bottom">
About you
</p>
Macro
Legend with size XL text and caption "after" as a paragraph
Open this example in a new tab: Legend with size XL text and caption "after" as a paragraph
About you
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--xl">
What is your home address?
</legend>
<p class="nhsuk-caption-xl nhsuk-caption--bottom">
About you
</p>
Macro
Legend with deprecated page heading
Open this example in a new tab: Legend with deprecated page heading
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with deprecated page heading overriding heading
Open this example in a new tab: Legend with deprecated page heading overriding heading
Code
Markup
<legend class="nhsuk-fieldset__legend">
What is your address?
</legend>
Macro
Legend with heading level 1
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with heading level 2
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
<h2 class="nhsuk-fieldset__heading">
What is your address?
</h2>
</legend>
Macro
Legend with heading level 3
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
<h3 class="nhsuk-fieldset__heading">
What is your address?
</h3>
</legend>
Macro
Legend with heading options only
Open this example in a new tab: Legend with heading options only
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--s">
<h3 class="nhsuk-fieldset__heading">
What is your address?
</h3>
</legend>
Macro
Legend with HTML
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with HTML via call block
Open this example in a new tab: Legend with HTML via call block
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with HTML via call block, without heading
Open this example in a new tab: Legend with HTML via call block, without heading
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
What is your address?
</legend>
Macro
Legend with id attribute
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l" id="custom-id">
<h1 class="nhsuk-fieldset__heading">
What is your address?
</h1>
</legend>
Macro
Legend with id attribute on heading
Open this example in a new tab: Legend with id attribute on heading
Code
Markup
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--l">
<h1 class="nhsuk-fieldset__heading" id="custom-id">
What is your address?
</h1>
</legend>
Macro
Legend without heading
Code
Markup
<legend class="nhsuk-fieldset__legend">
What is your address?
</legend>