I think I am missing something very simple.
I want my user to click on action button 1 so that action button 2 appears. But how can I 'render' a new action button in ui?
My code is below. Thank you very much!
library(shiny)
ui = shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
actionButton("button1", label = "Press Button 1")
),
mainPanel(
# what should I write here?
#renderPrint("button2")
)
)
))
server = shinyServer(function(input, output, session) {
observeEvent(input$button1, {
output$button2 <- renderUI({
actionButton("button2", label = "Press Button 2")
})
})
})
shinyApp(ui = ui, server = server)