Skip to contents

Generates outputs that can be written to clipboards with one click

Usage

clipboardOutput(
  outputId = rand_string(prefix = "clipboard"),
  message = "Copy to clipboard",
  clip_text = "",
  class = NULL,
  as_card_tool = FALSE
)

renderClipboard(
  expr,
  env = parent.frame(),
  quoted = FALSE,
  outputArgs = list()
)

Arguments

outputId

the output id

message

tool tip to show when mouse hovers on the element

clip_text

the initial text to copy to clipboards

class

'HTML' class of the element

as_card_tool

whether to make the output as card_tool

expr

expression to evaluate; the results will replace clip_text

env

environment to evaluate expr

quoted

whether expr is quoted

outputArgs

used to replace default arguments of clipboardOutput

Value

'HTML' elements that can write to clip-board once users click on them.

Examples

clipboardOutput(clip_text = "Hey there")
#> <div id="clipboardSwlKLUUEdL" class="shidashi-clipboard-output">
#>   <button class="clipboard-btn btn btn-default" data-clipboard-text="Hey there" role="button">Copy to clipboard</button>
#> </div>