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

Consider how to support content before and after inputs within a form group #478

Open
frankieroberto opened this issue Feb 22, 2024 · 1 comment

Comments

@frankieroberto
Copy link
Collaborator

This feature was added to the Nunjucks macros in Add beforeInput(s) and afterInput(s) options to form groups (#4567).

We could consider how we might support this too.

@frankieroberto
Copy link
Collaborator Author

One option is to have separate helpers for the form group and the label:

<%= f.govuk_form_group :price do %>
  <%= f.govuk_label :price, "Price" %>
  Content
  <%= f.govuk_text_field :price, label: nil, form_group: nil %>
  More content
<% end %>

Another option is to add before_input and after_input options to the existing helper, which would more closely follow the Nunjucks macro, but is maybe a bit unconventional for Rails?:

<%= f.govuk_text_field :price, 
  label: { text: "Price" }, 
  form_group: { before_input: "Content", after_input: "More content" } 
%>

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

No branches or pull requests

1 participant