% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/card-badge.R
\name{card_badge}
\alias{card_badge}
\alias{card_recalculate_badge}
\alias{enable_recalculate_badge}
\alias{disable_recalculate_badge}
\alias{set_card_badge}
\title{Create a badge widget located at card header}
\usage{
card_badge(text = NULL, class = NULL, ...)

card_recalculate_badge(
  text = "Recalculate needed",
  class = NULL,
  event_name = "run_analysis",
  ...
)

enable_recalculate_badge(text = "Recalculate needed", ...)

disable_recalculate_badge(text = "Up-to-date", ...)

set_card_badge(
  id = NULL,
  class = NULL,
  text = NULL,
  add_class = NULL,
  remove_class = NULL,
  session = shiny::getDefaultReactiveDomain()
)
}
\arguments{
\item{text}{inner text content of the badge}

\item{class}{additional 'HTML' class of the badge; for
\code{set_card_badge}, this is the class selector of the badge that is
to be changed}

\item{...}{additional 'HTML' tag attributes}

\item{event_name}{name of the event to trigger}

\item{id}{the badge 'HTML' ID to be changed, will be enclosed with
session namespace \code{session$ns(id)} automatically.}

\item{add_class, remove_class}{add or remove class}

\item{session}{shiny session}
}
\description{
Create a badge widget located at card header
}
\examples{

library(shidashi)

# UI: a Bootstrap badge with green background
card_badge("Ready", class = "bg-green shidashi-output-status")

# server
server <- function(input, output, session) {

  shiny::observe({

    # ... check if the inputs have changed

    set_card_badge(
      class = "shidashi-output-status",
      text = "Refresh needed",
      add_class = "bg-warning",
      remove_class = "bg-success disabled"
    )

  })

}

}
