To add clipboard to your xaringan presentation or R Markdown document, add the following code chunk to your slides' R Markdown file.
```r`r ''` xaringanExtra::use_clipboard() ```
You can also customize the text that is shown
by default when hovering over a code chunk
with the button_text
argument.
Use success_text
to specify the text shown when the copy action works,
or error_text
for the text shown when the copy action fails.
If the copy action fails, the text will still be selected,
so the user can still manually press Ctrl+C
to copy the code chunk.
These options accept raw HTML strings, so you can achieve an icon-only appearance using FontAwesome icons:
```r`r ''` htmltools::tagList( xaringanExtra::use_clipboard( button_text = "<i class=\"fa fa-clipboard\"></i>", success_text = "<i class=\"fa fa-check\" style=\"color: #90BE6D\"></i>", error_text = "<i class=\"fa fa-times-circle\" style=\"color: #F94144\"></i>" ), rmarkdown::html_dependency_font_awesome() ) ```
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.