Alerts are typically short status messages.

cli_alert(text, id = NULL, class = NULL, wrap = FALSE, .envir = parent.frame())

cli_alert_success(
  text,
  id = NULL,
  class = NULL,
  wrap = FALSE,
  .envir = parent.frame()
)

cli_alert_danger(
  text,
  id = NULL,
  class = NULL,
  wrap = FALSE,
  .envir = parent.frame()
)

cli_alert_warning(
  text,
  id = NULL,
  class = NULL,
  wrap = FALSE,
  .envir = parent.frame()
)

cli_alert_info(
  text,
  id = NULL,
  class = NULL,
  wrap = FALSE,
  .envir = parent.frame()
)

Arguments

text

Text of the alert.

id

Id of the alert element. Can be used in themes.

class

Class of the alert element. Can be used in themes.

wrap

Whether to auto-wrap the text of the alert.

.envir

Environment to evaluate the glue expressions in.

Examples

cli_alert("Cannot lock package library.")
#> → Cannot lock package library.
cli_alert_success("Package {.pkg cli} installed successfully.")
#> Package cli installed successfully.
cli_alert_danger("Could not download {.pkg cli}.")
#> Could not download cli.
cli_alert_warning("Internet seems to be unreacheable.")
#> ! Internet seems to be unreacheable.
cli_alert_info("Downloaded 1.45MiB of data")
#> Downloaded 1.45MiB of data