Skip to content
Nana UI

Alert

View .md Download

A contextual message banner for feedback, status and important notices. Supports an optional title, a leading status icon, action buttons and a dismiss control.

Heads up — this is an informational alert.
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/alert";
<nana-alert variant="info" open style="width:100%">Heads up — this is an informational alert.</nana-alert>
Info alert Success alert Warning alert Danger alert Neutral alert

Properties

PropertyAttributeTypeDefaultDescription
closablebooleanfalseShow a dismiss button that closes the alert
noIconno-iconbooleanfalseHide the leading status icon
openbooleantrueControls visibility. Dismissing sets this to `false`.
titlestring''Optional bold heading shown above the message
variantAlertVariant'info'Visual + semantic style

Events

EventDescription
nana-closeDispatched when the alert is dismissed

Slots

SlotDescription
(default)The alert message / body content
iconCustom leading icon (overrides the default variant icon)
actionsAction buttons shown beneath the message

CSS custom properties

PropertyDescription
--nana-alert-bgCustom background colour
--nana-alert-colorCustom text colour
--nana-alert-borderCustom border colour
EventTypeDescription
nana-closeCustomEventDispatched when the alert is dismissed
SlotDescription
(default)The alert message / body content
iconCustom leading icon (overrides the default variant icon)
actionsAction buttons shown beneath the message
VariableDefaultDescription
--nana-alert-bgCustom background colour
--nana-alert-colorCustom text colour
--nana-alert-borderCustom border colour
PartDescription
baseThe alert container
iconThe leading status icon
titleThe alert title
messageThe alert message body
actionsThe action buttons container
close-buttonThe dismiss button
Explore Alert interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook