bslib
bslib copied to clipboard
Add a `nav_get(target)` function to obtain the currenly selected nav_panel of a target nav container
It's currently possible to select, insert, remove, show or hide a nav panel of a parent container, but it isn't possible to query what panel is currently selected.
This feature would be useful for programmatically updating page contents based on the query result.
It isn't possible to query what panel is currently selected.
Are you aware that by adding an id (to the navset_() container) you can read the selected panel via an input value?
library(shiny)
library(bslib)
ui <- page_fluid(
navset_card_tab(
id = "tabs",
nav_panel("A", "a"),
nav_panel("B", "b")
)
)
server <- function(input, output, session) {
observe(print(input$tabs))
}
shinyApp(ui, server)