1. Collections Component Guide
  2. Copy to clipboard
  3. With data attributes
Copy to clipboard example

With data attributes

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/copy_to_clipboard", {
  label: "Copy and send this link to someone and they’ll be able to preview your draft on GOV.UK.",
  copyable_content: "http://www.example.org",
  input_data_attributes: {
    "tracking-code": "GA-123ABC"
  },
  button_text: "Copy link",
  button_data_attributes: {
    "tracking-code": "GA-123ABC"
  }
} %>