Radios
When to use this component
Use the radios component when users can only select one option from a list. This can be used when the target field is a lookup, select, boolean or text type.
When to not use this component
Do not use the radios component if users might need to select more than one option. In this case, you should use the checkboxes component instead.
How it works
Always position radios to the left of their labels. This makes them easier to find, especially for users of screen magnifiers.
Unlike with checkboxes, users can only select one option from a list of radios. Do not assume that users will know how many options they can select based on the visual difference between radios and checkboxes alone. If needed, add a hint explaining this, for example, 'Select one option'.
Do not pre-select radio options as this makes it more likely that users will not realise they've missed a question or submitted the wrong answer.
Users cannot go back to having no option selected once they have selected one, without refreshing their browser window. Therefore, you should include 'None of the above' or 'I do not know' if they are valid options.
Order radio options alphabetically by default.
HTML examples
Select the appropriate example from this page and directly integrate the HTML into your web template. You can customise these examples to align with your specific requirements, as indicated below. Refer to the layouts section for further guidance on structuring your web template.
If the component requires submission to a CRM field, ensure to replace the placeholder schema-name
text in the HTML example with the actual target field schema name.
Retain any prefixed or suffixed text related to the schema name.
For instance, if the id attribute reads schema-name-hint
in the example, ensure the replacement maintains the -hint
suffix (e.g. dfe_field-hint
).
This step is crucial for allowing the CRM helper framework to validate and submit data to CRM.
For single question pages
If presenting only one question on the page, designate the contents of the label
as the page heading.
This practice ensures users of screen readers hear the contents only once.
You will need to include an empty {% title %}
block in your web template to remove the default page header and avoid duplication.
Radio component
<div class="govuk-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading">
Where do you live?
</h1>
</legend>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name" name="schema-name" type="radio" value="england">
<label class="govuk-label govuk-radios__label" for="schema-name">
England
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-2" name="schema-name" type="radio" value="scotland">
<label class="govuk-label govuk-radios__label" for="schema-name-2">
Scotland
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-3" name="schema-name" type="radio" value="wales">
<label class="govuk-label govuk-radios__label" for="schema-name-3">
Wales
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-4" name="schema-name" type="radio" value="northern-ireland">
<label class="govuk-label govuk-radios__label" for="schema-name-4">
Northern Ireland
</label>
</div>
</div>
</fieldset>
</div>
{% extends 'DfE/Layouts/2ColumnWideLeft' %}
{% block title %}{% endblock %}
{% block main %}
{% unless user %}
<script>
window.location.href="{{ sitemarkers['DfE/Error/AccessDenied'].url }}"
</script>
{% endunless %}
## HTML content goes here ##
{% endblock %}
For multiple question pages
If presenting more than one question on the page, do not set the contents of the <legend>
as the page heading.
Radio component
<div class="govuk-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend">
Where do you live?
</legend>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name" name="schema-name" type="radio" value="england">
<label class="govuk-label govuk-radios__label" for="schema-name">
England
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-2" name="schema-name" type="radio" value="scotland">
<label class="govuk-label govuk-radios__label" for="schema-name-2">
Scotland
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-3" name="schema-name" type="radio" value="wales">
<label class="govuk-label govuk-radios__label" for="schema-name-3">
Wales
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-4" name="schema-name" type="radio" value="northern-ireland">
<label class="govuk-label govuk-radios__label" for="schema-name-4">
Northern Ireland
</label>
</div>
</div>
</fieldset>
</div>
{% extends 'DfE/Layouts/2ColumnWideLeft' %}
{% block main %}
{% unless user %}
<script>
window.location.href="{{ sitemarkers['DfE/Error/AccessDenied'].url }}"
</script>
{% endunless %}
## HTML content goes here ##
{% endblock %}
Using hint text
Use hint text to provide relevant assistance to the majority of users, such as clarifying how their information will be used or where to locate it. The hint text block is demonstrated in the example below.
Please ensure the following:
- Use the hint text block appropriately
- Place the hint block correctly within your HTML component
- Add the
aria-describedby
attribute where necessary, for accessiblity. For radios this is against thefieldset
.
Avoid lengthy paragraphs and lists in hint text, as screen readers will read out the entire content, potentially frustrating users. Additionally, refrain from including links within hint text, as screen readers do not indicate that the text is a clickable link.
Radio component
<div class="govuk-form-group">
<fieldset class="govuk-fieldset" aria-describedby="schema-name-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading">
How do you want to sign in?
</h1>
</legend>
<div id="schema-name-hint" class="govuk-hint">
You'll need an account to prove your identity
</div>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name" name="schema-name" type="radio" value="dfe-sign-in" aria-describedby="schema-name-item-hint">
<label class="govuk-label govuk-radios__label" for="schema-name">
Sign in with DfE Sign In
</label>
<div id="schema-name-item-hint" class="govuk-hint govuk-radios__hint">
You'll have a user ID if you've registered for DfE Sign In before
</div>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-2" name="schema-name" type="radio" value="govuk-one-login" aria-describedby="schema-name-2-item-hint">
<label class="govuk-label govuk-radios__label" for="schema-name-2">
Sign in with GOV.UK One Login
</label>
<div id="schema-name-2-item-hint" class="govuk-hint govuk-radios__hint">
If you don't have a GOV.UK One Login, you can create one
</div>
</div>
</div>
</fieldset>
</div>
{% extends 'DfE/Layouts/2ColumnWideLeft' %}
{% block title %}{% endblock %}
{% block main %}
{% unless user %}
<script>
window.location.href="{{ sitemarkers['DfE/Error/AccessDenied'].url }}"
</script>
{% endunless %}
## HTML content goes here ##
{% endblock %}
Inline radios
In some cases, you can choose to display radios 'inline' beside one another (horizontally). Only use inline radios when the question only has two options or both options are short.
On small screens such as mobile devices, the radios will still be 'stacked' on top of one another (vertically).
Radio component
<div class="govuk-form-group">
<fieldset class="govuk-fieldset" aria-describedby="schema-name-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading">
Have you changed your name?
</h1>
</legend>
<div id="schema-name-hint" class="govuk-hint">
This includes changing your last name or spelling your name differently
</div>
<div class="govuk-radios govuk-radios--inline" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name" name="schema-name" type="radio" value="yes">
<label class="govuk-label govuk-radios__label" for="schema-name">
Yes
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-2" name="schema-name" type="radio" value="no">
<label class="govuk-label govuk-radios__label" for="schema-name-2">
No
</label>
</div>
</div>
</fieldset>
</div>
{% extends 'DfE/Layouts/2ColumnWideLeft' %}
{% block title %}{% endblock %}
{% block main %}
{% unless user %}
<script>
window.location.href="{{ sitemarkers['DfE/Error/AccessDenied'].url }}"
</script>
{% endunless %}
## HTML content goes here ##
{% endblock %}
Conditionally revealing a related question
You can ask the user a related question when they select a particular radio option, so they only see the question when it's relevant to them.
This might make two related questions easier to answer by grouping them on the same page. For example, you could reveal a phone number input when the user selects the 'Contact me by phone' option.
If the related question is complicated or has more than one part, show it on the next page in the process instead.
Do not conditionally reveal questions to inline radios, such as 'yes' and 'no' options placed next to each other.
Conditionally reveal questions only - do not show or hide anything that is not a question.
Your schema names are likely to be different for your related questions. Using the above code example as reference, your 'Text message' option and related 'Mobile phone number' input are likely to have different schema names if you are submitting both values to fields in the CRM database. Be aware of this when replacing the 'schema-name' placeholder values.
Radio component
<div class="govuk-form-group">
<fieldset class="govuk-fieldset" aria-describedby="schema-name-hint">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h1 class="govuk-fieldset__heading">
How would you prefer to be contacted?
</h1>
</legend>
<div id="schema-name-hint" class="govuk-hint">
Select one option
</div>
<div class="govuk-radios" data-module="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name" name="schema-name" type="radio" value="email" data-aria-controls="conditional-schema-name">
<label class="govuk-label govuk-radios__label" for="schema-name">
Email
</label>
</div>
<div class="govuk-radios__conditional govuk-radios__conditional--hidden" id="conditional-schema-name">
<div class="govuk-form-group">
<label class="govuk-label" for="contact-by-email">
Email address
</label>
<input class="govuk-input govuk-!-width-one-third" id="contact-by-email" name="contactByEmail" type="email" spellcheck="false" autocomplete="email">
</div>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-2" name="schema-name" type="radio" value="phone" data-aria-controls="conditional-schema-name-2">
<label class="govuk-label govuk-radios__label" for="schema-name-2">
Phone
</label>
</div>
<div class="govuk-radios__conditional govuk-radios__conditional--hidden" id="conditional-schema-name-2">
<div class="govuk-form-group">
<label class="govuk-label" for="contact-by-phone">
Phone number
</label>
<input class="govuk-input govuk-!-width-one-third" id="contact-by-phone" name="contactByPhone" type="tel" autocomplete="tel">
</div>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="schema-name-3" name="schema-name" type="radio" value="text" data-aria-controls="conditional-schema-name-3">
<label class="govuk-label govuk-radios__label" for="schema-name-3">
Text message
</label>
</div>
<div class="govuk-radios__conditional govuk-radios__conditional--hidden" id="conditional-schema-name-3">
<div class="govuk-form-group">
<label class="govuk-label" for="contact-by-text">
Mobile phone number
</label>
<input class="govuk-input govuk-!-width-one-third" id="contact-by-text" name="contactByText" type="tel" autocomplete="tel">
</div>
</div>
</div>
</fieldset>
</div>
{% extends 'DfE/Layouts/2ColumnWideLeft' %}
{% block title %}{% endblock %}
{% block main %}
{% unless user %}
<script>
window.location.href="{{ sitemarkers['DfE/Error/AccessDenied'].url }}"
</script>
{% endunless %}
## HTML content goes here ##
{% endblock %}
Additional examples
Additional examples can be found on the GOV.UK Design System:
These examples will eventually be incorporated into this guidance, demonstrating how to use each of these additional examples with Power Pages. If you require assistance in the interim to adapt these additional examples for use with Power Pages and the CRM helper framework, please contact the Solutions Delivery Team.
Error messages
An error message is displayed next to the field and in the error summary when a validation error occurs. The CRM helper framework automatically handles error messages for specific error states, therefore you do not need to add any additional error containers to your HTML. Refer to the CRM helper framework guide to understand how to validate your front-end data.
Ensure that your component HTML and your inputs validation JavaScript object are structured correctly for your component type.
Occasionally you may wish to employ error messages outside of the validation process. You can read about the functions available within the CRM helper framework to assist you with this.
If you would like any additional advice or guidance with using these examples on Power Pages, please contact the Solutions Delivery Team.