I have multiple tabs within my R Shiny app and haven't discovered a way to have my action button navigate to another tab.
The first tab ends with a "submit info" action button, and the goal is to have the "results" tab open after the user submits. If anyone might have some pseudo code that could make this happen, anything would be extremely helpful.
Hi you can use updateTabsetPanel
to do that, you have to put an id to your tabsetPanel
(if you use a tabsetPanel
) and add session
to your server function :
library("shiny")
ui <- fluidPage(
tabsetPanel(
id = "tabs",
tabPanel(
title = "params",
actionButton(inputId = "submitInfo", label = "submit info")
),
tabPanel(
title = "result",
"result"
)
)
)
server <- function(input, output, session){
observeEvent(input$submitInfo, {
updateTabsetPanel(session = session, inputId = "tabs", selected = "result")
})
}
shinyApp(ui = ui, server = server)
If you use a navbarPage
or shinydashboard
it works the same way
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With