copyButton | R Documentation |
Create a copy button that will copy the contents of a target UI element or a provided value to the clipboard.
copyButton(id, target_id = NULL, text = NULL, cut = FALSE, label = "Copy", ...)
id |
The |
target_id |
The id of the UI output to copy. |
text |
Value to copy to the clipboard when the button is clicked. |
cut |
Cut text to clipboard. |
label |
Label of the button. |
... |
Other arguments passed to |
To update the value that will be copied from the server see
updateCopyText()
.
An actionButton
enabled to copy to clipboard.
if (interactive()) { ui <- fluidPage( textOutput("test_text"), # Copy other output copyButton("cp1", target_id = "test_text", icon = icon("clipboard")), # Copy a set value copyButton("cp2", text = "This is the text you want!", label = "Copy Text") ) server <- function(input, output, session) { output$test_text <- renderText("The text we are to copy!") } shinyApp(ui, server) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.