Radios
Nunjucks macro options
Use options to customise the appearance, content and behaviour of this component when using a macro, for example, changing the text.
Also see the guidance on the Radios component page, which shows these options in use within each example.
Some options are required for the macro to work; these are marked as "Required" in the option description. Deprecated options are marked as "Deprecated".
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.
Primary options
| object |
The fieldset used by the radios component.
See macro options for fieldset.
|
| object |
Can be used to add a hint to the radios component.
See macro options for hint.
|
| object |
Can be used to add an error message to the radios component. The error message component will not display if you use a falsy value for errorMessage, for example false or null.
See macro options for errorMessage.
|
| object |
Additional options for the form group containing the radios component.
See macro options for formGroup.
|
| string |
Optional prefix. This is used to prefix the id attribute for each radio input, hint and error message, separated by -. Defaults to the name option value.
|
| string |
Required.
Name attribute for the radio items.
|
| array |
Required.
The radio items within the radios component.
See macro options for items.
|
| string |
The value for the radio which should be checked when the page loads. Use this as an alternative to setting the checked option on each individual item.
|
| string |
Classes to add to the radio container.
|
| object |
HTML attributes (for example data attributes) to add to the radio container.
|
Options for items array objects
| string |
Required.
If html is set, this is not required. Text to use within each radio item label. If html is provided, the text option will be ignored.
|
| string |
Required.
If text is set, this is not required. HTML to use within each radio item label. If html is provided, the text option will be ignored.
|
| string |
Specific ID attribute for the radio item. If omitted, then idPrefix string will be applied.
|
| string |
Required.
Value for the radio input.
|
| object |
Subset of options for the label used by each radio item within the radios component.
See macro options for items label.
|
| object |
Can be used to add a hint to each radio item within the radios component.
See macro options for hint.
|
| string |
Divider text to separate radio items, for example the text "or".
|
| boolean |
Whether the radio should be checked when the page loads. Takes precedence over the top-level value option.
|
| object |
Provide additional content to reveal when the radio is checked.
See macro options for items conditional.
|
| boolean |
If true, radio will be disabled.
|
| object |
HTML attributes (for example data attributes) to add to the radio input tag.
|
Options for items label component
| string |
Classes to add to the label tag.
|
| object |
HTML attributes (for example data attributes) to add to the label tag.
|
Options for items conditional object
| string |
Required.
The HTML to reveal when the radio is checked.
|
Options for hint component
| string |
Required.
If html is set, this is not required. Text to use within the hint. If html is provided, the text option will be ignored.
|
| string |
Required.
If text is set, this is not required. HTML to use within the hint. If html is provided, the text option will be ignored.
|
| string |
Optional ID attribute to add to the hint span tag.
|
| string |
Classes to add to the hint span tag.
|
| object |
HTML attributes (for example data attributes) to add to the hint span tag.
|