Learn R Programming

nextGenShinyApps (version 2.1)

alert: Create an alert

Description

Create an alert with various styles

Usage

alert(
  ...,
  type = c("default", "standard"),
  close = FALSE,
  color = c("none", "primary", "secondary", "info", "success", "danger", "warning"),
  outline = FALSE,
  icon = NULL
)

Value

HTML of an alert box to be inserted within a page

Arguments

...

Content of the alert

type

Choose a style for the alert, choices include "default", "standard"

close

Allow alert to be closable, TRUE or FALSE

color

Color of the alert, choose between "none", "primary", "secondary", "info", "success", "danger", "warning"

outline

Include an outline and exclude background, TRUE or FALSE

icon

Include an icon to the left of the content

Examples

Run this code
if (interactive()) {
card(
  header = FALSE,
  shiny::h2("Standard alert (closeable)"),
  alert("EX1", type = "standard",
  color = "primary"),
  alert("EX2", type = "standard",
  color = "secondary"),
  alert("EX3", type = "standard",
  color = "secondary", outline = TRUE),
  alert("EX4", type = "standard",
  color = "danger", outline = TRUE, close = TRUE),
  alert("EX5", type = "standard",
  close = TRUE),
  alert("EX6", type = "standard",
  color = "primary", icon = shiny::icon("info"))
)
}

Run the code above in your browser using DataLab