{% from "../error-message/macro.njk" import govukErrorMessage -%} {% from "../fieldset/macro.njk" import govukFieldset %} {% from "../hint/macro.njk" import govukHint %} {% from "../input/macro.njk" import govukInput %} {#- 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.fieldset.describedBy if params.fieldset.describedBy else "" %} {% if params.items %} {% set dateInputItems = params.items %} {% else %} {% set dateInputItems = [ { name: "day", classes: "govuk-input--width-2" }, { name: "month", classes: "govuk-input--width-2" }, { name: "year", classes: "govuk-input--width-4" } ] %} {% endif %} {#- Capture the HTML so we can optionally nest it in a fieldset -#} {% set innerHtml %} {% if params.hint %} {% set hintId = params.id + "-hint" %} {% set describedBy = describedBy + " " + hintId if describedBy else hintId %} {{ govukHint({ id: hintId, classes: params.hint.classes, attributes: params.hint.attributes, html: params.hint.html, text: params.hint.text }) | indent(2) | trim }} {% endif %} {% if params.errorMessage %} {% set errorId = params.id + "-error" %} {% set describedBy = describedBy + " " + errorId if describedBy else errorId %} {{ govukErrorMessage({ id: errorId, classes: params.errorMessage.classes, attributes: params.errorMessage.attributes, html: params.errorMessage.html, text: params.errorMessage.text, visuallyHiddenText: params.errorMessage.visuallyHiddenText }) | indent(2) | trim }} {% endif %}