CopyButtonUpdate: Update text to be copied on the client

Description Usage Arguments Value Author(s) Examples

View source: R/copy.R

Description

Update text to be copied in clipboard on the client

Usage

1
2
3
4
5
6
7
8
CopyButtonUpdate(
  session,
  id = "copybtn",
  label = "Copy to Clipboard",
  icon = NULL,
  text = "Sample Text",
  modal = FALSE
)

Arguments

session

Session object passed to function given to shinyServer

id

HTML ID to use for button.

label

Text label of the button.

icon

icon to be shown on the button before label.

text

Text to be copied in clipboard.

modal

Whether button is used within bootstrap modal.

Value

Button

Author(s)

Deepanshu Bhalla

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
if (interactive()) {
 ui <- fluidPage(

  # Setup
  use_copy(),

  # Text Input 1
  textInput("text", "Enter Your Text"),

  # Copy Button 1
  CopyButton(
    "copybtn",
    "Copy to Clipboard",
    icon = icon("copy"),
    text = "No Text Found",
    class = "btn-primary",
    width = "150px"
  )

)
server <- function(input, output, session) {

  observe({

    req(input$copybtn)
    CopyButtonUpdate(session,
                     id = "copybtn",
                     label = "Copy to Clipboard",
                     icon = icon("copy"),
                     text = input$text
    )

  })

}

shinyApp(ui = ui, server = server)
}

deepanshu88/shinyCopy2clipboard documentation built on Dec. 19, 2021, 10:08 p.m.