Skip to content

Your web browser is out of date

Your web browser (the software you use to access the internet) is out of date. You need to update it or use a different web browser to ensure you can complete this form.

Cookies disabled

Cookies are currently not enabled in your web browser. You need to enable cookies to ensure you can complete this form.

Input

<div class="asp-form__group" id="change-text-input-default">
  <label class="asp-form__label" for="text-input-default">First name</label>
  <input class="asp-form__input" id="text-input-default" type="text" name="text-input-default" value=""  autocomplete="false" spellcheck="off">
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-default", label: "First name", name: "text-input-default" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-default", label: "First name", name: "text-input-default" }) }}

Text input with hint

<div class="asp-form__group" id="change-text-input-example-2">
  <label class="asp-form__label" for="text-input-example-2">First name</label>
  <p class="asp-form__hint">Hint.</p>
  <input class="asp-form__input" id="text-input-example-2" type="text" name="text-input-example-2" value=""  autocomplete="false" spellcheck="off">
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-2", label: "First name", hint: "Hint.", name: "text-input-example-2" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-2", label: "First name", hint: "Hint.", name: "text-input-example-2" }) }}

Text input with submission error

<div class="asp-form__group asp-form__group--error asp-form__js-group--error" id="change-text-input-example-3">
  <label class="asp-form__label" for="text-input-example-3">First name</label>
  <p class="asp-form__error-message asp-form__js-error-message">
    <span class="asp-form__js-error-message--intial">&quot;First name&quot; is required</span>
    <span class="asp-form__js-error-message--live"></span>
  </p>
  <input class="asp-form__input asp-form__input--error asp-form__js-input--error" id="text-input-example-3" type="text" name="text-input-example-3" value=""  autocomplete="false" spellcheck="off">
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-3", label: "First name", error: ""First name" is required", name: "text-input-example-3" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-3", label: "First name", error: ""First name" is required", name: "text-input-example-3" }) }}

Text input with hint and submission error

<div class="asp-form__group asp-form__group--error asp-form__js-group--error" id="change-text-input-example-4">
  <label class="asp-form__label" for="text-input-example-4">First name</label>
  <p class="asp-form__hint">Hint</p>
  <p class="asp-form__error-message asp-form__js-error-message">
    <span class="asp-form__js-error-message--intial">&quot;First name&quot; is required</span>
    <span class="asp-form__js-error-message--live"></span>
  </p>
  <input class="asp-form__input asp-form__input--error asp-form__js-input--error" id="text-input-example-4" type="text" name="text-input-example-4" value=""  autocomplete="false" spellcheck="off">
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-4", label: "First name", hint: "Hint", error: ""First name" is required", name: "text-input-example-4" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-4", label: "First name", hint: "Hint", error: ""First name" is required", name: "text-input-example-4" }) }}

<div class="form__group" id="search-example-1">  
  <label class="form__label" for="search-example-1-text-input">Search records</label>  
  <p class="form__hint">Search by occurrence number, VIM reference number, suspect name or witness name</p>  
  <div class="form__group--inner form__group--inner-with-button">  
    <input class="form__input" id="search-example-1-text-input" type="text">  
    <button class="button button--start button--append" type="submit">Search</button>  
  </div>  
</div>

Text input read only

WIP -- Not just adding the readonly attribute but the className .form__input--readonly

<div class="asp-form__group" id="change-text-input-example-5">
  <label class="asp-form__label" for="text-input-example-5">First name</label>
  <p class="asp-form__hint">Other persons previously accused of this offence but who are not the co-accused</p>
  <input class="asp-form__input asp-form__input--readonly" id="text-input-example-5" type="text" name="text-input-example-5" value="Person A"  readonly>
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-5", label: "First name", hint: "Other persons previously accused of this offence but who are not the co-accused", name: "text-input-example-5", readonly: true, value: "Person A" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-5", label: "First name", hint: "Other persons previously accused of this offence but who are not the co-accused", name: "text-input-example-5", readonly: true, value: "Person A" }) }}

Text input for collar number

<div class="form__group" id="collar-number-example-1">  
  <label class="form__label" for="collar-number-example-1-number">Requested by (collar number)</label>  
  <label class="sr-only" for="collar-number-example-1-name">Officer name</label>  
  <div class="form__group--inner">  
    <div class="form__collar">  
      <input class="form__input" id="collar-number-example-1-number" type="text">  
    </div>  
    <input class="form__input form__input--readonly" id="collar-number-example-1-name" type="text" readonly>  
  </div>  
</div>

Text input with a prefix

<div class="asp-form__group" id="change-text-input-example-6">
  <label class="asp-form__label" for="text-input-example-6">Total value</label>
  <p class="asp-form__hint">Give your estimate. For example 2,500</p>
  <div class="asp-form__inner asp-form--width-12-chars"><span class="asp-form__input asp-form__input--prefix">£</span><input class="asp-form__input" id="text-input-example-6" type="text" name="text-input-example-6" value=""  autocomplete="false" spellcheck="off"></div>
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-6", label: "Total value", hint: "Give your estimate. For example 2,500", prefix: "£", name: "text-input-example-6" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-6", label: "Total value", hint: "Give your estimate. For example 2,500", prefix: "£", name: "text-input-example-6" }) }}

Text input with a suffix

<div class="asp-form__group" id="change-text-input-example-7">
  <label class="asp-form__label" for="text-input-example-7">Percentage</label>
  <div class="asp-form__inner asp-form--width-12-chars"><input class="asp-form__input" id="text-input-example-7" type="text" name="text-input-example-7" value=""  autocomplete="false" spellcheck="off"><span class="asp-form__input asp-form__input--suffix">%</span></div>
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-7", label: "Percentage", suffix: "%", name: "text-input-example-7" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-7", label: "Percentage", suffix: "%", name: "text-input-example-7" }) }}

Text input within complex fieldsets

<fieldset class="form__fieldset form__group" id="complex-example-1">  
  <legend class="sr-only">Address</legend>  
  <div class="form__group">  
    <label class="form__label" for="complex-example-1-postcode">Postcode search</label>  
    <div class="form__group--inner form__group--inner-with-button">  
      <input class="form__input" id="complex-example-1-postcode">  
      <button class="button button--start button--append" type="button">Find address</button>  
    </div>  
  </div>

<div class="form__group" id="complex-example-1-postcodegroup" hidden>
<label class="form__label" for="complex-example-1-suspect-address-selection">Select an address</label>
<select class="form__input" id="complex-example-1-suspect-address-selection">
</select>
</div>

<div class="form__group">
<p class="form__label" aria-hidden="true">Building and street (optional)</p>
<label class="sr-only" for="complex-example-1-suspect-address-1">Building (optional)</label>
<input class="form__input" id="complex-example-1-suspect-address-1">
<div class="form__group--100">
<label class="sr-only" for="complex-example-1-suspect-address-2">Street (optional)</label>
<input class="form__input" id="complex-example-1-suspect-address-2">
</div>
</div>

<div class="form__group">
<label class="form__label" for="complex-example-1-suspect-town">Town or city (optional)</label>
<input class="form__input" id="complex-example-1-suspect-town">
</div>

<div class="form__group">
<label class="form__label" for="complex-example-1-suspect-county">County (optional)</label>
<input class="form__input" id="complex-example-1-suspect-county">
</div>

<div class="form__group">
<label class="form__label" for="complex-example-1-suspect-country">Country</label>
<p class="form__error-message"></p>
<select class="form__input" id="complex-example-1-suspect-country">
<option>Select Country</option>
<option value="england" id="england">England</option>
</select>
</div>

<div class="form__group">
<label class="form__label" for="complex-example-1-suspect-postcode">Postcode (optional)</label>
<p class="form__error-message"></p>
<input class="form__input" id="complex-example-1-suspect-postcode">
</div>
</fieldset>

When to use this component

Use the text input component when you need to let users enter text that’s no longer than a single line, such as their name or phone number.

This component can be added within a conditional question.

When not to use this component

Do not use the text input component if you need to let users enter longer answers that might span multiple lines. In this case, you should use the textarea component.

You should align labels above the text input they refer to. They should be short, direct and written in sentence case. Do not use colons at the end of labels.

Placeholder text

Do not use placeholder text in place of a label, or for hints or examples, as:

  • it vanishes when the user starts typing, which can cause problems for users with memory conditions or when reviewing answers
  • not all screen readers read it out
  • its browser default styles often do not meet minimum contrast requirements

Autocomplete attribute

Use of the autocomplete attribute should be considered very carefully. Due to the nature of the information being collected, the default for autocomplete is to set it to off, reducing the risk of exposing sensitive information.

For example, to enable autofill on a postcode field, set the autocomplete attribute to first-name. See how to do this in the HTML and Nunjucks tabs in the following example.

<div class="asp-form__group" id="change-text-input-example-8">
  <label class="asp-form__label" for="text-input-example-8">First name</label>
  <input class="asp-form__input" id="text-input-example-8" type="text" name="text-input-example-8" value=""  autocomplete="name" spellcheck="off">
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-8", label: "First name", autocomplete: "name", name: "text-input-example-8" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-8", label: "First name", autocomplete: "name", name: "text-input-example-8" }) }}

Avoid restricting the length of a user’s input

Using the maxlength attribute means there is no feedback to users that their text input is truncated. This is especially true where the text has been copied and pasted from elsewhere. This can cause users to accidentally provide incorrect or incomplete information.

A restrictive maximum length can stop users from formatting information in their usual way. For example, putting spaces in a postcode or commas in a large number.

Some assistive technologies do not tell users if an input has a maxlength set or if the user has passed the limit. Voice control software may insert additional spaces into the input.

If you must enforce a maximum length for technical reasons, inform the user of the limit in the hint, but allow them to provide more information.

<div class="asp-form__group" id="change-text-input-example-9">
  <label class="asp-form__label" for="text-input-example-9">First name</label>
  <input class="asp-form__input" id="text-input-example-9" type="text" name="text-input-example-9" value=""  autocomplete="false" spellcheck="off" maxlength="30" data-countdown>
  <p id="text-input-example-9-countdown">You can enter up to 30 characters</p>
</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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-9", label: "First name", maxlength: 30, name: "text-input-example-9" }) }}

Twig 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 Description
id string Required. The id given to the text input. Values should use alphanumeric characters with hypthens, underscores and fullstops.
changeLinkId string The id of link given to the field for changing or addressing errors. Values should use alphanumeric characters with hypthens, underscores and fullstops.
label string Required. The descriptive text associated with the text input that explains its purpose.
hideLabel boolean Whether the lable is visually hidden. Default values (for the last breadcrumb item) are true, false (boolean) or null.
hint string A more explicit descriptive text associated with the text input that explains what kind of information is expected.
error string The descriptive text associated with the text input that explains any errors. If the text input is readonly, this will be ignored.
prefix string The prefix value. If both prefix and suffix is supplied, both will be ignored.
suffix string The suffix value. If both prefix and suffix is supplied, both will be ignored.
characters interger or string The length of the input based upon characters. Default values are 2, 4, 8, 12, 36, 52 and 'full' for full width. If either prefix and suffix is supplied, this param will be ignored.
type string The type of input. Default values are 'text', 'email', 'number', 'tel' and 'password'. If this param is ommitted then 'text' will be used.
name string Required. Used for JavaScript whilst editing or to reference data after a form is submitted. Values should use alphanumeric characters with hypthens, underscores and fullstops.
value string, integer or null The value of the text input.
dataRegex string Regex pattern. Only present if data-name is populated.
dataName string The text before " is invalid". Only present if dataRegex is populated.
dataHint string The text after dataHint. Only present if dataRegex and dataName is populated.
dataIgnoreSpaces string Spaces within the value should be ignored when checking the regex. Only present if dataRegex and dataName is populated.
readonly string If dataRegex and dataName are populated, this attribute will be ignored. If this is present, the following parameters - autocomplete, spellchecker and maxlength will be ignored.
autocomplete boolean or string Values can be found https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete. Default values are 'false' or null (shows as "false"), 'true' (shows as "true").
spellcheck boolean or string Default values are 'off', 'false' or null (shows as "off"), 'on', 'true' (shows as "on").
maxlength interger This is the number of characters for the text input remaining. Default values are null or 'false' which doesn't show the maxlength and countdown feature.
required boolean Sets wheather the text input has an html5 required attribute. If the text input is readonly, this attribute will be ignored.
attributes array or false (boolean) A list of additional attributes. A (key) name for each is required but corresponding value is not required. See attributes.
classes array or false (boolean) An array of additional classes. Default values are false (boolean) or null.

Options for attributes

Name Type Description
name string Required. The name of the attribute.
value string The value of the attribute. Note, boolean values must be strings. Default values are false (boolean) or null.
{% from "components/input/macro.njk" import aspInput %}

{{ aspInput({ id: "text-input-example-9", label: "First name", maxlength: 30, name: "text-input-example-9" }) }}

When JavaScript is enabled, the message should be “You have XX characters remaining”. This will tailor to interactions / prepopulated content on page load. Default (JavaScript disabled) message “You can enter up to XX characters”.

Use appropriately-sized text inputs

Help users understand what they should enter by making text inputs the right size for the content they’re intended for.

By default, the width of text inputs is fluid and will fit the full width of the container they are placed into.

If you want to make the input smaller, you can either use a fixed width input, or use the width override classes to create a smaller, fluid width input.

<div class="form__group form__input--long" id="text-input-example-1">  
  <label class="form__label" for="text-input-example-1-text-input">First name</label>  
  <input class="form__input " id="text-input-example-1-text-input" type="text">  
</div>

<div class="form__group" id="text-input-example-2">
<label class="form__label" for="text-input-example-2-text-input">First name</label>
<input class="form__input" id="text-input-example-2-text-input" type="text">
</div>

<div class="form__group form__input--short" id="text-input-example-3">
<label class="form__label" for="text-input-example-3-text-input">First name</label>
<input class="form__input" id="text-input-example-3-text-input" type="text">
</div>

Status of development

The below criteria all need to be met for a component to be considered as fully developed for use within the ASP Digital Design System.

Development criteria Status
WCAG 2.2 compliant Not started
WCAG 2.1 compliant Completed
HTML / Nunjucks version In Progress
Figma version Not started
M365 versions Not started
Documentation In progress

Make a change to the Design System

Suggest an edit to this system, or any of the components in it, by submitting a Design System change request.


Published 3 May 2024
Last updated 24 October 2025