hideNavTabs: Hide and show tabs

View source: R/server.R

hideNavTabsR Documentation

Hide and show tabs

Description

Hides tabs until they are useful, for example the results tabs before any data has been uploaded, and shows them again from the server.

Usage

hideNavTabs(rootID, tabIDs)

showNavTabs(rootID, tabIDs)

Arguments

rootID

ID of the row of tabs.

tabIDs

IDs of the tabs to hide or show, as a character vector.

Details

rootID is the id of the biLevelTab(), triSubTab() or triSubSidebarTab() holding the tabs, or "root" for the top-level tabs in the navigation bar. tabIDs are the tabs to hide or show:

  • Sub tabs: their values. These default to the title with spaces removed, and spaces are removed here too, so the titles themselves work.

  • Top-level tabs (rootID = "root"): their titles, exactly as written, spaces included.

showNavTabs() also selects the first tab in tabIDs, briefly selecting the second first, so the tab's contents are drawn straight away.

Value

NULL, invisibly. Called for its effect on the page.

Examples

if (interactive()) {
  shiny::shinyApp(
    ui = UINav(
      appName = "Demo",
      biLevelTab("Results",
        subTab("Start", navButton("go", "Show the results")),
        subTab("Table", navOutputText("tableText")),
        subTab("Plot", navOutputText("plotText"))
      )
    ),
    server = function(input, output, session) {
      hideNavTabs("Results", c("Table", "Plot"))
      shiny::observeEvent(input$go, {
        showNavTabs("Results", c("Table", "Plot"))
      })
    }
  )
}

EZRShiny documentation built on Oct. 10, 2026, 5:08 p.m.