if(interactive()){
library(shiny)
ui <- fluidPage(
column(
6,
textButton(textId = "tbtn_default", label = "default"),
textButton(
textId = "tbtn-icon",
label = "change icon and color",
btn_icon = icon("house"),
class = "btn-warning" # pass to the button
),
textButton(
textId = "tbtn_style",
label = "change styles",
style = "color: red; border: 2px dashed green;"
),
textButton(
textId = "tbtn_submit",
label = "interact with shiny server",
btn_label = "Submit",
placeholder = "type and submit",
class = "btn-primary"),
verbatimTextOutput("tbtn_submit_out")
)
)
server <- function(input, output, session) {
# watch for the button ID "tbtn_submit" + "_btn"
observeEvent(input$tbtn_submit_btn, {
output$tbtn_submit_out <- renderPrint(isolate(input$tbtn_submit))
})
}
shinyApp(ui, server)
}
Run the code above in your browser using DataLab