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 theshad-alert__iconclass.- class
Extra CSS classes.
See also
Other shadshiny tier-1 components:
shad_aspect_ratio(),
shad_avatar(),
shad_badge(),
shad_breadcrumb(),
shad_button(),
shad_button_group(),
shad_card(),
shad_code_block(),
shad_empty(),
shad_item(),
shad_kbd_group(),
shad_label(),
shad_progress(),
shad_scroll_fade(),
shad_separator(),
shad_shimmer(),
shad_skeleton(),
shad_spinner(),
shad_table(),
shad_typography
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>