Skip to content
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 label or legend param to date-input #1155

Open
penx opened this issue Jan 21, 2019 · 0 comments
Open

Add label or legend param to date-input #1155

penx opened this issue Jan 21, 2019 · 0 comments
Labels
date input feature request User requests a new feature nunjucks

Comments

@penx
Copy link

penx commented Jan 21, 2019

When I started using the date-input I was expecting to be able to pass in a label param.

{{ govukDateInput({
  id: "dob",
  namePrefix: "dob",
  label: "What is your date of birth?"
}) }}

In actual fact what I needed to pass was params.fieldset.legend.text:

{{ govukDateInput({
  id: "dob",
  namePrefix: "dob",
  fieldset: {
    legend: {
      text: "What is your date of birth?"
    }
  }
}) }}

The actual usage seems overly complex given that I expect most users just want to specify a string.

I accept the fieldset/legend isn't really a label in the html sense, so would propose one of the following:

  1. allow a new label or legend prop to be passed as a string, that, if set, is used instead of fieldset.legend.text

legend: params.fieldset.legend

becomes (written in JS/pseudocode as I am still learning nunjucks):

    legend: { text: params.label, ...params.fieldset.legend }
  1. allow the fieldset param to optionally be passed in as a string
    legend: isString(params.fieldset) ? { text: params.fieldset } : params.fieldset.legend

This is low priority for me personally, but suggested in case others think it worthwhile.

@penx penx changed the title Add label param to date-input Add label or legend param to date-input Jan 21, 2019
@36degrees 36degrees added the awaiting triage Needs triaging by team label Jan 23, 2019
@kellylee-gds kellylee-gds added feature request User requests a new feature and removed awaiting triage Needs triaging by team labels Jan 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
date input feature request User requests a new feature nunjucks
Projects
None yet
Development

No branches or pull requests

7 participants