ClipboardCopy

readyNot reviewed for a11y
This page may be removed. Primer plans to move all Rails component documentation to Lookbook.

Description

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

This component by itself is not styled as a button, and can therefore only be used in limited circumstances. If you're looking for a button, consider using Primer::Beta::ClipboardCopyButton instead.

Accessibility

Always set an accessible label to help the user interact with the component.

This component has a built-in aria-live region that announces "Copied!" when the copy element is pressed.

Arguments

NameRequiredDescription
aria-label
String

String that will be read to screenreaders when the component is focused

value
String

Text to copy into the users clipboard when they click the component.

for
String

Element id from where to get the copied value.

system_arguments