Hint text
Use hint text to help users understand a question.
<div class="hse-form-group">
<fieldset class="hse-fieldset" aria-describedby="contact-hint">
<legend class="hse-fieldset__legend hse-fieldset__legend--l">
<h1 class="hse-fieldset__heading">
How would you like to be contacted?
</h1>
</legend>
<span class="hse-hint" id="contact-hint">
Select all options that are relevant to you.
</span>
<div class="hse-checkboxes">
<div class="hse-checkboxes__item">
<input class="hse-checkboxes__input" id="contact" name="contact" type="checkbox" value="email">
<label class="hse-label hse-checkboxes__label" for="contact">
Email
</label>
</div>
<div class="hse-checkboxes__item">
<input class="hse-checkboxes__input" id="contact-2" name="contact" type="checkbox" value="phone">
<label class="hse-label hse-checkboxes__label" for="contact-2">
Phone
</label>
</div>
<div class="hse-checkboxes__item">
<input class="hse-checkboxes__input" id="contact-3" name="contact" type="checkbox" value="text message">
<label class="hse-label hse-checkboxes__label" for="contact-3">
Text message
</label>
</div>
</div>
</fieldset>
</div>
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 | Required | Description |
---|---|---|---|
Name text | Type string | Required true | Description If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name html | Type string | Required true | Description If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name id | Type string | Required false | Description Id attribute to add to the hint. |
Name classes | Type string | Required false | Description Classes to add to the hint. |
Name attributes | Type object | Required false | Description HTML attributes (for example data attributes) to add to the hint. |
{% from 'checkboxes/macro.njk' import checkboxes %}
{{ checkboxes({
"idPrefix": "contact",
"name": "contact",
"fieldset": {
"legend": {
"text": "How would you like to be contacted?",
"classes": "hse-fieldset__legend--l",
isPageHeading: true
}
},
"hint": {
"text": "Select all options that are relevant to you."
},
"items": [
{
"value": "email",
"text": "Email",
id: "contact"
},
{
"value": "phone",
"text": "Phone"
},
{
"value": "text message",
"text": "Text message"
}
]
}) }}
How to use hint text
Use hint text to give users help in context. For example, where to find information or how their data will be used.
Text input with hint text
<div class="hse-form-group">
<label class="hse-label" for="example-with-hint-text">
What is your HSE number?
</label>
<span class="hse-hint" id="example-with-hint-text-hint">
Your HSE number is a 10 digit number that you find on any letter the HSE has sent you. For example, 485 777 3456.
</span>
<input class="hse-input hse-input--width-10" id="example-with-hint-text" name="example-with-hint-text" type="text" aria-describedby="example-with-hint-text-hint">
</div>
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 | Required | Description |
---|---|---|---|
Name text | Type string | Required true | Description If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name html | Type string | Required true | Description If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name id | Type string | Required false | Description Id attribute to add to the hint. |
Name classes | Type string | Required false | Description Classes to add to the hint. |
Name attributes | Type object | Required false | Description HTML attributes (for example data attributes) to add to the hint. |
{% from 'input/macro.njk' import input %}
{{ input({
"label": {
"text": "What is your HSE number?"
},
"hint": {
"text": "Your HSE number is a 10 digit number that you find on any letter the HSE has sent you. For example, 485 777 3456."
},
id: "example-with-hint-text",
name: "example-with-hint-text",
classes: "hse-input--width-10",
inputmode: "numeric"
}) }}
Radios with hint text
<fieldset class="hse-fieldset">
<legend class="hse-fieldset__legend hse-fieldset__legend--l">
<h1 class="hse-fieldset__heading">
Do you know your HSE number?
</h1>
</legend>
<span class="hse-hint hse-u-margin-bottom-2">
This is a 10 digit number, like 485 777 3456.
</span>
<span class="hse-hint">
You can find it on any letter the HSE has sent you, on a prescription or by logging in to a GP practice online service.
</span>
<div class="hse-form-group">
<div class="hse-radios">
<div class="hse-radios__item">
<input class="hse-radios__input" id="example-hints-1" name="example-hints" type="radio" value="yes">
<label class="hse-label hse-radios__label" for="example-hints-1">
Yes, I know my HSE number
</label>
</div>
<div class="hse-radios__item">
<input class="hse-radios__input" id="example-hints-2" name="example-hints" type="radio" value="no">
<label class="hse-label hse-radios__label" for="example-hints-2">
No, I do not know my HSE number
</label>
</div>
<div class="hse-radios__item">
<input class="hse-radios__input" id="example-hints-3" name="example-hints" type="radio" value="not sure">
<label class="hse-label hse-radios__label" for="example-hints-3">
I'm not sure
</label>
</div>
</div>
</div>
</fieldset>
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 | Required | Description |
---|---|---|---|
Name text | Type string | Required true | Description If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name html | Type string | Required true | Description If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name id | Type string | Required false | Description Id attribute to add to the hint. |
Name classes | Type string | Required false | Description Classes to add to the hint. |
Name attributes | Type object | Required false | Description HTML attributes (for example data attributes) to add to the hint. |
{% from 'radios/macro.njk' import radios %}
{% from 'fieldset/macro.njk' import fieldset %}
{% from 'hint/macro.njk' import hint %}
{% call fieldset({
legend: {
"text": "Do you know your HSE number?",
"classes": "hse-fieldset__legend--l",
"isPageHeading": true
}
}) %}
{{ hint({
"text": "This is a 10 digit number, like 485 777 3456.",
"classes": "hse-u-margin-bottom-2"
}) }}
{{ hint({
"text": "You can find it on any letter the HSE has sent you, on a prescription or by logging in to a GP practice online service."
}) }}
{{ radios({
"idPrefix": "example-hints",
"name": "example-hints",
"items": [
{
"value": "yes",
"text": "Yes, I know my HSE number"
},
{
"value": "no",
"text": "No, I do not know my HSE number"
},
{
"value": "not sure",
"text": "I'm not sure"
}
]
}) }}
{% endcall %}
Radio items with hints
You can add hints to radios to give more information about the options.
<div class="hse-form-group">
<fieldset class="hse-fieldset">
<legend class="hse-fieldset__legend hse-fieldset__legend--l">
<h1 class="hse-fieldset__heading">
How do you want to sign in?
</h1>
</legend>
<div class="hse-radios">
<div class="hse-radios__item">
<input class="hse-radios__input" id="example-hints-1" name="example-hints" type="radio" value="gateway" aria-describedby="example-hints-1-item-hint">
<label class="hse-label hse-radios__label" for="example-hints-1">
Sign in with HSE login
</label>
<span class="hse-hint hse-radios__hint" id="example-hints-1-item-hint">
You'll have a user ID if you've registered for the HSE App.
</span>
</div>
<div class="hse-radios__item">
<input class="hse-radios__input" id="example-hints-2" name="example-hints" type="radio" value="verify" aria-describedby="example-hints-2-item-hint">
<label class="hse-label hse-radios__label" for="example-hints-2">
Sign in with MyGovID
</label>
<span class="hse-hint hse-radios__hint" id="example-hints-2-item-hint">
You'll have an account if you've already proved your identity with MyGovID.
</span>
</div>
</div>
</fieldset>
</div>
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 | Required | Description |
---|---|---|---|
Name text | Type string | Required true | Description If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name html | Type string | Required true | Description If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name id | Type string | Required false | Description Id attribute to add to the hint. |
Name classes | Type string | Required false | Description Classes to add to the hint. |
Name attributes | Type object | Required false | Description HTML attributes (for example data attributes) to add to the hint. |
{% from 'radios/macro.njk' import radios %}
{{ radios({
"idPrefix": "example-hints",
"name": "example-hints",
"fieldset": {
"legend": {
"text": "How do you want to sign in?",
"classes": "hse-fieldset__legend--l",
"isPageHeading": true
}
},
"items": [
{
"value": "gateway",
"text": "Sign in with HSE login",
"hint": {
"text": "You'll have a user ID if you've registered for the HSE App."
}
},
{
"value": "verify",
"text": "Sign in with MyGovID",
"hint": {
"text": "You'll have an account if you've already proved your identity with MyGovID."
}
}
]
}) }}
Checkboxes with hint text
Users can select more than 1 option from a list of checkboxes.Do not assume that users will know how many options they can select.
<div class="hse-form-group">
<fieldset class="hse-fieldset" aria-describedby="contact-hint">
<legend class="hse-fieldset__legend hse-fieldset__legend--l">
<h1 class="hse-fieldset__heading">
How would you like to be contacted?
</h1>
</legend>
<span class="hse-hint" id="contact-hint">
Select all options that are relevant to you.
</span>
<div class="hse-checkboxes">
<div class="hse-checkboxes__item">
<input class="hse-checkboxes__input" id="contact" name="contact" type="checkbox" value="email">
<label class="hse-label hse-checkboxes__label" for="contact">
Email
</label>
</div>
<div class="hse-checkboxes__item">
<input class="hse-checkboxes__input" id="contact-2" name="contact" type="checkbox" value="phone">
<label class="hse-label hse-checkboxes__label" for="contact-2">
Phone
</label>
</div>
<div class="hse-checkboxes__item">
<input class="hse-checkboxes__input" id="contact-3" name="contact" type="checkbox" value="text message">
<label class="hse-label hse-checkboxes__label" for="contact-3">
Text message
</label>
</div>
</div>
</fieldset>
</div>
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 | Required | Description |
---|---|---|---|
Name text | Type string | Required true | Description If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name html | Type string | Required true | Description If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name id | Type string | Required false | Description Id attribute to add to the hint. |
Name classes | Type string | Required false | Description Classes to add to the hint. |
Name attributes | Type object | Required false | Description HTML attributes (for example data attributes) to add to the hint. |
{% from 'checkboxes/macro.njk' import checkboxes %}
{{ checkboxes({
"idPrefix": "contact",
"name": "contact",
"fieldset": {
"legend": {
"text": "How would you like to be contacted?",
"classes": "hse-fieldset__legend--l",
isPageHeading: true
}
},
"hint": {
"text": "Select all options that are relevant to you."
},
"items": [
{
"value": "email",
"text": "Email",
id: "contact"
},
{
"value": "phone",
"text": "Phone"
},
{
"value": "text message",
"text": "Text message"
}
]
}) }}
Textarea with hint text
<div class="hse-form-group">
<label class="hse-label" for="example">
Can you provide more detail?
</label>
<span class="hse-hint" id="example-hint">
Do not include personal or financial information, for example, your National Insurance number or credit card details.
</span>
<textarea class="hse-textarea" id="example" name="example" rows="5" aria-describedby="example-hint"></textarea>
</div>
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 | Required | Description |
---|---|---|---|
Name text | Type string | Required true | Description If `html` is set, this is not required. Text to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name html | Type string | Required true | Description If `text` is set, this is not required. HTML to use within the hint. If `html` is provided, the `text` argument will be ignored. |
Name id | Type string | Required false | Description Id attribute to add to the hint. |
Name classes | Type string | Required false | Description Classes to add to the hint. |
Name attributes | Type object | Required false | Description HTML attributes (for example data attributes) to add to the hint. |
{% from 'textarea/macro.njk' import textarea %}
{{ textarea({
"name": "example",
"id": "example",
"label": {
"text": "Can you provide more detail?"
},
"hint": {
"text": "Do not include personal or financial information, for example, your National Insurance number or credit card details."
}
}) }}
Updated: August 2023