Alert

Static feedback for information, warnings or status updates.

When to use

Use an alert for contextual feedback that belongs beside the affected content, such as a validation result or a saved-state message. Use a Toast for a brief notification that does not need to stay in the document flow.

Default

Use .alert for static feedback.

Project settings saved.

Background colors

Combine .alert with a background utility.

alert primary
alert secondary
alert success
alert warning
alert error
alert inverse
HTML
<div class="alert bg-primary">alert primary</div>
<div class="alert bg-secondary">alert secondary</div>
<div class="alert bg-success">alert success</div>
<div class="alert bg-warning">alert warning</div>
<div class="alert bg-error">alert error</div>
<div class="alert bg-inverse">alert inverse</div>

With content

Use .alert-content, .alert-title and .alert-message for structured content.

HTML
<div class="alert bg-success" role="alert">
	<div class="alert-content">
		<p class="alert-title">Success</p>
		<p class="alert-message">Your changes were saved successfully.</p>
	</div>
</div>

Closable

Use .alert-close for the close action.

HTML
<div class="alert bg-error" role="alert">
	<div class="alert-content">
		<p class="alert-title">Save failed</p>
		<p class="alert-message">Project settings could not be saved. Try again.</p>
	</div>

	<button class="alert-close icon-btn icon-btn-text" type="button" aria-label="Close alert">
		×
	</button>
</div>

Accessibility and behavior

  • Keep a clear message in text; color and icons only reinforce the outcome. Use headings when the feedback contains several paragraphs or actions.
  • Choose role="status" for polite dynamic feedback or role="alert" for an urgent interruption. Static guidance normally needs neither live-region role.
  • The close control is a named native button. Application code handles dismissal and preserves or restores focus when removing a message that contains the focused control. The package supplies styles.

CSS variables

Override these base defaults on the listed selector after the library styles. Variants and states may replace them; global tokens follow the active theme.

TokenDefaultPurposeScope / state
--alert-padding-yvar(--spacer-3)Top and bottom padding..alert
--alert-padding-xvar(--spacer-3)Left and right padding..alert
--alert-bg-colorvar(--bg-surface)Background color..alert
--alert-colorvar(--text-color)Text and icon color..alert
--alert-border-widthvar(--border-width)Border thickness..alert
--alert-border-colorvar(--border-color)Border color..alert
--alert-border-radiusvar(--border-radius)Corner radius..alert
--alert-gapvar(--spacer-2)Space between child elements..alert