Password input
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 Password input 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
| string |
The ID of the input. Defaults to the value of name.
|
| string |
Required.
The name of the input, which is submitted with the form data.
|
| string |
Optional initial value of the input.
|
| boolean |
If true, input will be disabled.
|
| string |
One or more element IDs to add to the aria-describedby attribute, used to provide additional descriptive information for screenreader users.
|
| object |
Required.
The label used by the text input component.
See macro options for label.
|
| object |
Can be used to add a hint to a text input component.
See macro options for hint.
|
| object |
Can be used to add an error message to the text input 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 text input component.
See macro options for formGroup.
|
| string |
Classes to add to the input.
|
| string |
Attribute to meet WCAG success criterion 1.3.5: Identify input purpose. See the Autofill section in the HTML standard for full list of attributes that can be used. Default is "current-password".
|
| object |
HTML attributes (for example data attributes) to add to the input.
|
| string |
Button text when the password is hidden. Defaults to "Show".
|
| string |
Button text when the password is visible. Defaults to "Hide".
|
| string |
Button text exposed to assistive technologies, like screen readers, when the password is hidden. Defaults to "Show password".
|
| string |
Button text exposed to assistive technologies, like screen readers, when the password is visible. Defaults to "Hide password".
|
| string |
Announcement made to screen reader users when their password has become visible in plain text. Defaults to "Your password is visible".
|
| string |
Announcement made to screen reader users when their password has been obscured and is not visible. Defaults to "Your password is hidden".
|
| object |
Optional object allowing customisation of the toggle button.
See macro options for button.
|
Options for label component
| string |
Required.
If html is set, this is not required. Text to use within the 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 the label. If html is provided, the text option will be ignored.
|
| string |
The value of the for attribute, the ID of the input the label is associated with.
|
| boolean |
Whether the label also acts as the heading for the page.
|
| string |
Classes to add to the label tag.
|
| object |
HTML attributes (for example data attributes) to add to the label tag.
|
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.
|