I would like to display the current tab that I am on in an R Shiny App. I have viewed the questions related to this on SO, but I just can't get it to work. I assume I'm doing something silly. The issue might be with the nested tabs? This is my first SO post, so I tried my best to great a reprex.
Previous questions:
- How to use tabPanel as input in R Shiny?
- How do I access/print/track the current tab selection in a Shiny app?
library(shiny)
ui = navbarPage("My Shiny App", id = "Top Page",
tabPanel(title = "My Tabs",
tabsetPanel(type = "tabs", id = "tabset",
tabPanel(title = "My First Tab", value = "tab_1",
textOutput("mytab")),
tabPanel(title = "My Second Tab", value = "tab_2",
textOutput("mytab"))
)
)
)
server = function(input, output) {
output$mytab <- renderText({
paste("You are viewing tab: ", input$tabs)
})
}
shinyApp(ui = ui, server = server)