Add error param to input #1150
Labels
feature request
User requests a new feature
🕔 hours
A well understood issue which we expect to take less than a day to resolve.
At the moment, date-input passes a CSS class to input when it wants to mark a field as having an error:
govuk-frontend/src/components/date-input/template.njk
Line 64 in e70f59d
govuk-frontend/src/components/date-input/date-input.yaml
Lines 125 to 126 in e70f59d
This implies that the user of the date-input has inferred knowledge of the inner workings (CSS class name) of input.
I propose that an 'error' param is added to input so that, when using the input template, the user (be it an application using the input template or another component) doesn't need to have inferred knowledge of the class names. The classes param would still exist so this approach would also still work, but the preferred approach would be to use the error param.
This would mean adding an error param to input as follows:
before:
after:
And changing the date-input examples as follows:
before:
after:
This may seem like a trivial issue for users of the nunjucks templates - but when working on ports (e.g. using CSSinJS or CSS modules) it is useful for one component/template to not have to have knowledge of the inner workings of another.
The text was updated successfully, but these errors were encountered: