1. Component Guide
  2. Form fieldset
  3. With error message
Form fieldset example

With error message

The component also accepts an error_id, or generates one automatically.

How it looks (preview)

Do you have a passport? Error: Please choose an option

How to call this example

<%= render "govuk_publishing_components/components/fieldset", {
  legend_text: "Do you have a passport?",
  error_message: "Please choose an option"
} do %>
  <!-- Use the radio component, this is hardcoded only for this example -->
  <input type="radio" id="default2-yes" name="default2">
  <label for="default2-yes">Yes</label>

  <input type="radio" id="default2-no" name="default2">
  <label for="default2-no">No</label>
<% end %>