How to update button labels in R Shiny?

后端 未结 4 1891
独厮守ぢ
独厮守ぢ 2021-01-20 00:10

The R Shiny website has a great example of how to update the labels and values of a variety of input types based on user input. However, I couldn\'t find anything for butto

4条回答
  •  攒了一身酷
    2021-01-20 00:56

    updateActionButton:

    ui <- fluidPage(
      actionButton('someButton', ""),
      textInput("newLabel", "new Button Label:", value = "some label")
    )
    
    server <- function(input, output, session) {
    
      observeEvent(input$newLabel, {
        updateActionButton(session, "someButton", label = input$newLabel)
      })
    }
    
    shinyApp(ui, server)
    

提交回复
热议问题