1. Government Frontend Component Guide
  2. Form radio button
  3. With data attributes

Form radio button example

With data attributes

How it looks

How to call this example

<%= render "govuk_publishing_components/components/radio", {
  name: "radio-group-data-attributes",
  items: [
    {
      value: "cool-button",
      text: "Best button in town",
      data_attributes: {
        "contextual-guidance": "cool-buttons-guidance"
      }
    },
    {
      value: "no-data-attributes-button",
      text: "Worst button in town"
    }
  ]
} %>