Description Usage Arguments Examples
Helper for adding code-specific action button
1 2 | showCodeButton(inputId, label = "Show R Code", icon = shiny::icon("code"),
...)
|
inputId |
The |
label |
The contents of the button or linkâusually a text label, but you could also use any other HTML, like an image. |
icon |
An optional |
... |
Named attributes to be applied to the button or link. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Not run:
library(shiny)
ui <- fluidPage(
scriptglossJS(),
selectInput('x', 'x axis', choices = names(mtcars)),
selectInput('y', 'y axis', choices = names(mtcars)),
showCodeButton("show_code"),
plotOutput('plot')
)
srv <- function(input, output, session) {
output$plot <- renderPlot({
plot(x = mtcars[[input$x]], y = mtcars[[input$y]])
})
observeEvent(input$show_code, show_code_modal(srv, "plot"))
}
shinyApp(ui, srv)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.