rclipboard (version 0.1.2)

rclipButton: Send to clipboard action button

Description

Creates an action button that will send user-defined text to the OS clipboard.

Usage

rclipButton(inputId, label, clipText, icon = NULL, width = NULL, modal = FALSE)

Arguments

inputId

The input slot that will be used to access the value.

label

The contents of the button or link--usually a text label, but you could also use any other HTML, like an image.

clipText

A single scalar character variable to be sent to the clipboard.

icon

An optional icon to appear on the button.

width

The width of the input, e.g. '400px', or '100%'; see validateCssUnit.

modal

A logical flag indicating whether the button will be shown in a modal window (TRUE) or not (NOT).

References

https://clipboardjs.com/

See Also

rclipboardSetup

Examples

Run this code
# NOT RUN {
## Not run
# }
# NOT RUN {
library(rclipboard)
library(shiny)

# The UI
ui <- bootstrapPage(
  
  rclipboardSetup(),
  
  # Add a text input
  textInput("copytext", "Copy this:", "Zlika!"),

  # UI ouputs for the copy-to-clipboard buttons
  uiOutput("clip"),
  
  # 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"))
  })
  
}

shinyApp(ui = ui, server = server)
# }

Run the code above in your browser using DataLab