Add another (experimental) example
Default
How it looks
(preview)
How to call this example
<%= render "govuk_publishing_components/components/add_another", {
fieldset_legend: "Person",
add_button_text: "Add another person",
items: [
{
fields: sanitize("<div class=\"govuk-form-group\">
<label for=\"person_0_name\" class=\"gem-c-label govuk-label\">Full name</label>
<input class=\"gem-c-input govuk-input\" id=\"person_0_name\" name=\"person[0]name\">
</div>
"),
destroy_checkbox: sanitize("<div class=\"govuk-checkboxes\" data-module=\"govuk-checkboxes\" data-govuk-checkboxes-init=\"\">
<div class=\"govuk-checkboxes__item\">
<input type=\"checkbox\" name=\"person[0][_destroy]\" id=\"person_0__destroy\" class=\"govuk-checkboxes__input\">
<label for=\"person_0__destroy\" class=\"govuk-label govuk-checkboxes__label\">Delete</label>
</div>
</div>
")
}
],
empty: sanitize("<div class=\"govuk-form-group\"> <label for=\"person_1_name\" class=\"gem-c-label govuk-label\">Full name</label> <input class=\"gem-c-input govuk-input\" id=\"person_1_name\" name=\"person[1]name\"> </div>")
} %>