| updateGlassTabBadge | R Documentation |
Adds or updates a small numeric badge on a tab button - useful for
surfacing counts such as unread items, pending rows, or notification
totals. Set count to 0 or NA to hide the badge.
updateGlassTabBadge(session, id, value, count)
session |
Shiny session object. |
id |
Module id matching the |
value |
Value of the tab to update. |
count |
Integer count to display. Values above 99 are shown as
|
Called for its side effect; returns NULL invisibly.
Other glass tabs:
appendGlassTab(),
disableGlassTab(),
glassTabCondition(),
glassTabPanel(),
glassTabsOutput(),
glassTabsServer(),
glassTabsUI(),
renderGlassTabs(),
showGlassTab(),
updateGlassTabsUI()
if (interactive()) {
library(shiny)
ui <- fluidPage(
useGlassTabs(),
glassTabsUI(
"tabs",
glassTabPanel("inbox", "Inbox", p("Messages here"), selected = TRUE),
glassTabPanel("sent", "Sent", p("Sent items")),
glassTabPanel("drafts", "Drafts", p("Draft items"))
),
actionButton("refresh", "Refresh counts")
)
server <- function(input, output, session) {
observeEvent(input$refresh, {
updateGlassTabBadge(session, "tabs", "inbox", count = sample(1:20, 1))
updateGlassTabBadge(session, "tabs", "drafts", count = sample(0:5, 1))
})
}
shinyApp(ui, server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.