showCodeButton: Helper for adding code-specific action button

Description Usage Arguments Examples

Description

Helper for adding code-specific action button

Usage

1
2
showCodeButton(inputId, label = "Show R Code", icon = shiny::icon("code"),
  ...)

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.

icon

An optional icon to appear on the button.

...

Named attributes to be applied to the button or link.

Examples

 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)

dgkf/scriptgloss documentation built on June 8, 2019, 8:43 p.m.