Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bs4RemoveTab

Remove a bs4TabPanel in a bs4TabSetPanel


Description

Usage

bs4RemoveTab(inputId, target, session = shiny::getDefaultReactiveDomain())

Arguments

inputId

bs4TabSetPanel id.

target

bs4TabPanel to remove.

session

Shiny session object.

Examples

if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 ui <-  bs4DashPage(
   sidebar_collapsed = TRUE,
   sidebar = bs4DashSidebar(),
   bs4DashFooter(),
   body = bs4DashBody(
     actionButton("remove1","Remove tab 1"),
     bs4TabSetPanel(
       id = "tabset1", 
       side = "left",
       bs4TabPanel(
         tabName = "Tab 1",
         active = TRUE,
         p("Text 1"),
       ),
       bs4TabPanel(
         tabName = "Tab 2",
         active = FALSE,
         p("Text 2"),
       )
     ),
     actionButton("remove2","Remove tab 2"),
     bs4TabSetPanel(
       id = "tabset2", 
       side = "left",
       bs4TabPanel(
         tabName = "Tab 1",
         active = TRUE,
         p("Text 1"),
       ),
       bs4TabPanel(
         tabName = "Tab 2",
         active = FALSE,
         p("Text 2"),
       )
     )
   )
 )
 
 server <- function(input, output, session) {
   
   observeEvent(input$remove1, {
     bs4RemoveTab(
       inputId = "tabset1",
       target = "Tab 1"
     )
   })
   
   observeEvent(input$remove2, {
     bs4RemoveTab(
       inputId = "tabset2",
       target = "Tab 2",
     )
   })
   
 }
 shinyApp(ui, server)
}

bs4Dash

A 'Bootstrap 4' Version of 'shinydashboard'

v0.5.0
GPL (>= 2) | file LICENSE
Authors
David Granjon [aut, cre], RinteRface [cph], Almasaeed Studio [ctb, cph] (AdminLTE3 theme for Bootstrap 4), Winston Chang [ctb, cph] (Utils functions from shinydashboard), Thomas Park [ctb, cph] (Bootswatch Sketchy theme CSS)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.