Skip to content

ClipboardCopy

Table of contents
Table of contents
This component requires JavaScript to function. Please refer to the Installation section to set it up.

Use ClipboardCopy to copy element text content or input values to the clipboard.

Examples

Default

<%= render(Primer::ClipboardCopy.new(value: "Text to copy", label: "Copy text to the system clipboard")) %>

With text instead of icons

Click to copy!
<%= render(Primer::ClipboardCopy.new(value: "Text to copy", label: "Copy text to the system clipboard")) do %>
Click to copy!
<% end %>

Arguments

NameTypeDefaultDescription
labelStringN/AString that will be read to screenreaders when the component is focused
valueStringN/AText to copy into the users clipboard when they click the component
system_argumentsHashN/ASystem arguments