Description Usage Arguments Examples
View source: R/update-functions.R
Remove a bs4TabPanel in a bs4TabSetPanel
1 | bs4RemoveTab(inputId, target, session = shiny::getDefaultReactiveDomain())
|
inputId |
bs4TabSetPanel id. |
target |
bs4TabPanel to remove. |
session |
Shiny session object. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.