-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for customising item inputs’ field names in date-input #826
Conversation
Add support for a new `item.{}.fieldName` parameter on the `date-input` macro. This allows the author to explicitly set the field name on each item input rather than rely on the `<param.name>-<item.name>` default convention, which is not always convenient and couples the field name to the displayed label too tightly. Also fix a few minor missing/incorrect parts in the date-input README.
d790cdb
to
98abbac
Compare
Hi James, thanks for raising this. As it involves modifying what we deem as public api, we'll have a discussion how to proceed. |
Thanks for the update @igloosi. The primary reason for its introduction was down to our particular need to have date inputs named as Secondly, it seemed that the name was perhaps being too tightly coupled with the presentation by virtue of suffixing Look forward to the outcomes of your discussion 👍 |
That makes sense - I can see how this change would be beneficial. I'd like to try and avoid adding another similarly-named argument if at all possible - I don't think the distinction between If we were to make e.g. "name": (params.name + "-" + item.name) if params.name else item.name, Ollie |
Hi Ollie. That would be perfect, and is a much cleaner api that reflects the semantic use of govukInput({
"label": {
"text": item.name | capitalize,
"classes": 'govuk-date-input__label'
},
...
}) Perhaps the introduction of an
(and default values are used if not specified by the template author) |
It could even be made a little simpler, and align more with other components by just adding a new This is the way it's done in other macros, such as |
Add support for a new
item.{}.fieldName
parameter on thedate-input
macro. This allows the author to explicitly set the field name on each
item input rather than rely on the
<param.name>-<item.name>
defaultconvention, which is not always convenient and couples the field name to
the displayed label too tightly.
Also fix a few minor missing/incorrect parts in the date-input README.