app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook_rails

You can use any external control (like the text itself or an icon) to copy. To use this hook, set the data-external-copy-from attribute on the external control to the copying ID. This will grab the innerText from your_id element, or value if it is an input element. Alternatively, you can set a data-external-copy-value attribute and copy custom text.

See the code example for details.