Skip to contents

dashboardBadge creates a badge. It may be inserted in any element like inside a actionButton or a dashboardSidebar.

Usage

bs4Badge(..., color, position = c("left", "right"), rounded = FALSE)

dashboardBadge(..., color, position = c("left", "right"), rounded = FALSE)

Arguments

...

Badge content.

color

Badge color. Valid colors:

  • primary: #007bff .

  • secondary: #6c757d .

  • info: #17a2b8 .

  • success: #28a745 .

  • warning: #ffc107 .

  • danger: #dc3545 .

position

Badge position: "left" or "right".

rounded

Whether the badge is rounded instead of square. FALSE by default.

Author

David Granjon, dgranjon@ymail.com

Examples

if(interactive()){
 library(shiny)
 library(bs4Dash)
 
 shinyApp(
  ui = dashboardPage(
    dashboardHeader(),
    dashboardSidebar(),
    dashboardBody(
     dashboardBadge("Badge 1", color = "danger"),
     actionButton(
      inputId = "badge", 
      label = "Hello", 
      icon = NULL, 
      width = NULL, 
      dashboardBadge(1, color = "primary")
     )
    )
  ),
  server = function(input, output) { }
 )
}