{% macro govukInput(params) %} {% from "govuk_frontend_jinja/macros/attributes.html" import govukAttributes %} {% from "govuk_frontend_jinja/components/error-message/macro.html" import govukErrorMessage %} {% from "govuk_frontend_jinja/components/hint/macro.html" import govukHint %} {% from "govuk_frontend_jinja/components/label/macro.html" import govukLabel %} {#- Set classes for this component #} {%- set classNames = "govuk-input" -%} {%- if params.classes %} {% set classNames = classNames ~ " " ~ params.classes %} {% endif %} {%- if params.errorMessage %} {% set classNames = classNames ~ " govuk-input--error" %} {% endif %} {#- a record of other elements that we need to associate with the input using aria-describedby – for example hints or error messages -#} {% set describedBy = params.describedBy if params.describedBy else undefined -%} {%- set hasPrefix = true if params.prefix and (params.prefix.text or params.prefix.html) else false %} {%- set hasSuffix = true if params.suffix and (params.suffix.text or params.suffix.html) else false %} {%- set hasBeforeInput = true if params.formGroup and params.formGroup.beforeInput and (params.formGroup.beforeInput.text or params.formGroup.beforeInput.html) else false %} {%- set hasAfterInput = true if params.formGroup and params.formGroup.afterInput and (params.formGroup.afterInput.text or params.formGroup.afterInput.html) else false %} {%- macro _inputElement(params) -%} {%- endmacro -%} {%- macro _affixItem(affix, type) %}
{%- endmacro -%}