Shiny/R Wrapper for 'clipboard.js'

Leverages the functionality of 'clipboard.js', a JavaScript library for HMTL5-based copy to clipboard from web pages (see <> for more information), and provides a reactive copy-to-clipboard UI button component, called 'rclipButton', for 'shiny' R applications.


clipboard.js is a super light javascript framework, which provides copy-to-clipboard functionality using HTML5. The simple rclipboard R package is simple and leverages clipboard.js functionality to provide a reactive copy-to-clipboard UI button component, called rclipButton, for Shiny R applications.


This example works when deployed on a Shiny server or when it is run from RStudio. However, because of limitations in the web engine of current RStudio versions, the rclipButton does not work natively when the application is run locally. A workaround must be implemented in the form of an observeEvent associated to the rclipButton and using the clipr function from the clipr package. Note that this function only works when the application is run locally and not when deployed on a server.

# The UI
ui <- bootstrapPage(
  # Add a text input
  textInput("copytext", "Copy this:", "Zlika!"),
  # UI ouputs for the copy-to-clipboard buttons
  # A text input for testing the clipboard content.
  textInput("paste", "Paste here:")
# The server
server <- function(input, output) {
  # Add clipboard buttons
  output$clip <- renderUI({
    rclipButton("clipbtn", "rclipButton Copy", input$copytext, icon("clipboard"))
  # Workaround for execution within RStudio
  observeEvent(input$clipbtn, clipr::write_clip(input$copytext))
shinyApp(ui = ui, server = server)


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.3 by Sebastien Bihorel, 10 months ago

Report a bug at

Browse source code at

Authors: Sebastien Bihorel

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports shiny

Imported by aweSOM, filterNHP, safetyGraphics, spotGUI.

Suggested by SingleCaseES, idiogramFISH, journalabbr, scdhlm.

See at CRAN