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 helper for generating a label only #480

Closed
frankieroberto opened this issue Feb 22, 2024 · 0 comments
Closed

Add helper for generating a label only #480

frankieroberto opened this issue Feb 22, 2024 · 0 comments

Comments

@frankieroberto
Copy link
Collaborator

Usually a label is generated as part of the helper for the text input, as both the label and the input get wrapped in a "form group" container, which then gets a red border on the left when there’s an error present.

However there might be some rare occasions where it's best to generate the label separately, for example if the labels and inputs are within a table.

This would allow us to support this:

<tr>
  <th><%= f.govuk_label :price, "Price" %></th>
  <td><%= f.govuk_text_field :price, label: nil %></td>
</tr>
peteryates added a commit that referenced this issue Jul 21, 2024
This simply exposes GOVUKDesignSystemFormBuilder::Elements::Label via a
new `#govuk_label` method on the builder object. It is intended to be
used on occasions where the label isn't wanted immediately above the
input, such as in a table.

Fixes #480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant