tab_visibility: Show/Hide Tab

Description Usage Arguments Value Examples

Description

Dynamically show or hide a tab_panel or navbar_menu

Usage

1
2
3
show_tab(session = shiny::getDefaultReactiveDomain(), id, target)

hide_tab(session = shiny::getDefaultReactiveDomain(), id, target)

Arguments

session

The session object passed to function given to shinyServer.

id

The id of the navbar object

target

The tab value to toggle visibility

Value

Changes to the visibility of a tab in the shiny UI.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (interactive()) {
  library(shiny)
  library(shiny.semantic)

  ui <- navbar_page(
    title = "App Title",
    id = "navbar",
    tab_panel(
      "Plot",
      action_button("hide", "Hide Table"),
      action_button("show", "Show Table"),
      value = "plot"
    ),
    tab_panel("Summary", value = "summary"),
    tab_panel("Table", value = "table")
  )

  server <- function(input, output, session) {
    observeEvent(input$hide, hide_tab(session, "navbar", "table"))
    observeEvent(input$show, show_tab(session, "navbar", "table"))
  }

  shinyApp(ui, server)
}

fomantic.plus documentation built on Jan. 25, 2022, 1:15 a.m.