Skip to contents

A callout banner with an optional icon.

Usage

shad_alert(
  title = NULL,
  ...,
  variant = c("default", "destructive"),
  icon = NULL,
  class = NULL
)

Arguments

title

Alert title. Optional.

...

Description content (and optional named attributes).

variant

One of "default", "destructive".

icon

Optional icon (a shad_icon() name or tag). Rendered with the shad-alert__icon class.

class

Extra CSS classes.

Value

A <div role="alert">.

Examples

shad_alert("Heads up!", "You can add components via the CLI.", icon = "terminal")
#> <div class="shad-alert" role="alert">
#>   <svg class="shad-alert__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/></svg>
#>   <div class="shad-alert__title">Heads up!</div>
#>   <div class="shad-alert__description">You can add components via the CLI.</div>
#> </div>
shad_alert("Error", "Session expired.", variant = "destructive",
           icon = "circle-alert")
#> <div class="shad-alert shad-alert--destructive" role="alert">
#>   <svg class="shad-alert__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/></svg>
#>   <div class="shad-alert__title">Error</div>
#>   <div class="shad-alert__description">Session expired.</div>
#> </div>