Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbihorel/rclipboard
clipboard.js for R/Shiny Applications
https://github.com/sbihorel/rclipboard
Last synced: 3 months ago
JSON representation
clipboard.js for R/Shiny Applications
- Host: GitHub
- URL: https://github.com/sbihorel/rclipboard
- Owner: sbihorel
- License: other
- Created: 2016-12-11T03:33:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-15T09:28:05.000Z (12 months ago)
- Last Synced: 2024-07-07T14:45:40.228Z (4 months ago)
- Language: R
- Size: 39.1 KB
- Stars: 47
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - rclipboard - Wrapper for clipboard.js to create copy-to-clipboard buttons for Shiny apps. (UI Components / Clipboard)
- jimsghstars - sbihorel/rclipboard - clipboard.js for R/Shiny Applications (R)
README
[![CRAN status](https://www.r-pkg.org/badges/version/rclipboard)](https://CRAN.R-project.org/package=rclipboard)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)# rclipboard: clipboard.js for R/Shiny applications
[clipboard.js](https://clipboardjs.com/) 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`, and a
reactive copy-to-clipboard UI link component, called `rclipLink`, for
[Shiny](https://shiny.posit.co/) R applications.While `rclipButton` and `rclipLink` will work in applications that use native
`shiny` UI constructors, the code below illustrates a marginally more complex
example in which a tooltip is displayed when hovering on top of the button thanks
to the use of UI constructors from the `bslib` package.```R
library(shiny)
library(bslib)
library(rclipboard)# The UI
ui <- bslib::page_fluid(
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(
inputId = "clipbtn",
label = "rclipButton Copy",
clipText = input$copytext,
icon = icon("clipboard"),
tooltip = "Click me... I dare you!",
placement = "top",
options = list(delay = list(show = 800, hide = 100), trigger = "hover")
)
})
}shinyApp(ui = ui, server = server)
```