| appendGlassTab | R Documentation |
appendGlassTab() adds a new glassTabPanel() to an existing
glassTabsUI() at runtime. removeGlassTab() removes a tab by value.
If the removed tab was active, the first remaining tab is activated.
appendGlassTab(session, id, tab, select = FALSE)
removeGlassTab(session, id, value)
session |
Shiny session object. |
id |
Module id matching the |
tab |
A |
select |
Logical. If |
value |
Value of the tab to remove (for |
Called for its side effect; returns NULL invisibly.
Other glass tabs:
disableGlassTab(),
glassTabCondition(),
glassTabPanel(),
glassTabsOutput(),
glassTabsServer(),
glassTabsUI(),
renderGlassTabs(),
showGlassTab(),
updateGlassTabBadge(),
updateGlassTabsUI()
if (interactive()) {
library(shiny)
ui <- fluidPage(
useGlassTabs(),
glassTabsUI(
"tabs",
glassTabPanel("home", "Home", p("Home content"), selected = TRUE)
),
actionButton("add", "Add tab"),
actionButton("remove", "Remove tab")
)
server <- function(input, output, session) {
observeEvent(input$add, {
appendGlassTab(session, "tabs",
glassTabPanel("new", "New Tab", p("Dynamic content")),
select = TRUE
)
})
observeEvent(input$remove, {
removeGlassTab(session, "tabs", "new")
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.