Is there a way to use configurations (e.g. golem configure) to define tabsets in shiny on load?

40 Views Asked by At

I have multiple versions of the same app, which I am currently managing via different git branches, but it is becoming more difficult to mass-apply commits across branches. I would like to bring it all back to one branch, and maintain a simple golem configuration to define a tabset, e.g.

default:
  tabs: tab1, tab2, tab3
app1:
  tabs: tab1, tab2
app2: 
  tabs: tab2, tab3

The tabset would be defined on load, and stay static throughout the interaction. The dynamic tabsets described in Mastering Shiny do not seem appropriate. Is there a way to define the UI on load?

1

There are 1 best solutions below

0
On

I can use a combination of observeEvent(once=T) and updateTabsetPanel().

observeEvent(input$controller, {
  updateTabsetPanel(session, "inTabset",
    selected = stringr::str_trim(unlist(stringr::str_split(get_golem_config("tabs"), ",")))
  )
}, once=TRUE)