Clipboard copy

Clipboard copy copies element text content or input values to the clipboard.

v0.36.1BetaNot reviewed for accessibility

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 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

NameTypeDefaultDescription
aria-label
String

N/A

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

value
String

nil

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

for
String

N/A

Element id from where to get the copied value.

system_arguments
Hash

N/A

Examples