Skip to content

Alert ​

A feedback banner for surface-level status messages: errors, warnings, successes, and informational notices. Supports an optional heading, icon, metadata, action buttons, and a dismiss button.

Variants ​

Three visual styles are available via the variant attribute. flat is the default: the same calm surface ore-toast uses — opaque neutral card, ink text, hairline border — with the color carried by the icon and accent instead of the whole box, so a stack of alerts stays readable and errors still stand out. bordered puts that color on the surface and border using the theme's tinted backdrop pairing (same as badges) while the text stays neutral ink, and solid fills the box with the theme color; slotted ghost/text actions automatically take the alert's contrast ink there (set --button-color on a button to opt out per button).

Full width

Colors ​

The theme color tints the automatic icon, the accented edge, and — for bordered — the backdrop surface and border; solid fills the whole box. Text stays neutral ink on flat and bordered, keeping it AA-readable on every color in both schemes.

Full width

Sizes ​

Full width

Heading ​

Use heading to add a bold heading above the message body.

Full width

Dismissible ​

Add dismissible to show a close (×) button. When clicked, the component plays a ore-alert-exit animation (opacity fade + height collapse) before applying [dismissed] which sets display: none. An alert entering the page plays the matching enter animation (unfold + fade); both honor Motion Mode. Listen to the dismiss event to remove it from the DOM or restore it later. Always supply a color to convey semantic intent (color="error" for failures, color="success" for confirmations, etc.).

Full width
javascript
document.querySelector('ore-alert').addEventListener('dismiss', (e) => {
  e.target.remove(); // optionally remove from DOM entirely
});

Icon ​

Setting color renders a matching glyph automatically: info for primary/secondary/info, check for success, triangle-alert for warning, and circle-alert for error — the same vocabulary ore-toast uses per severity.

Full width

Set icon to any icon name to pick the glyph yourself, or icon="none" to render a bare alert. A colorless alert never renders an automatic icon.

Full width

Content in the icon slot always wins over both: use it for custom SVGs, avatars, or a differently sized glyph (ore-toast passes its own leading icon this way). The icon wrapper is hidden entirely when nothing fills it: no reserved space.

Full width

Meta ​

Use the meta slot to add secondary information (e.g. a timestamp) displayed alongside the heading in a lighter, smaller style. Pair it with a heading for best results.

Full width

Actions ​

Use the actions slot to add call-to-action buttons below the message. Avoid nesting complex interactive controls in the default slot; keep alerts primarily informational. Give actions a semantic emphasis (see Button emphasis) and keep one primary per alert: in development, an actions row with more than one emphasis="primary" button logs a warning.

Full width

Horizontal Actions ​

Add horizontal to move the actions to the right side of the content instead of below it. Works with a heading (the heading and message stack in the content column) and stays a single row on phones.

Full width

TIP

Avoid combining horizontal with heading: it makes the layout feel cramped.

Accented ​

Add accented to add a thick left border for extra visual emphasis. Only applies to flat and bordered variants.

Full width

Site Banner ​

An alert pinned to a viewport edge or stretched across the page makes a slim announcement banner: one short message, one or two actions, and a dismiss affordance. Show one banner at a time; the banner owns presentation only, so persist dismissal (dismiss event + hide it yourself on next load).

Slim Row ​

slim tightens the padding and puts icon, text, and actions on one wrapping row — the classic announcement strip.

Full width

Pinned Banner ​

docked="top" or docked="bottom" fixes the banner to that viewport edge, clear of the safe-area insets. It is full-bleed by default; set --alert-max-width for a boxed card centered in the dock.

html
<!-- Pinned to the bottom edge, full-bleed -->
<ore-alert docked="bottom" slim dismissible>
  Scheduled maintenance tonight 02:00–03:00 UTC.
  <ore-button slot="actions" size="sm" variant="ghost" href="/status">Status page</ore-button>
</ore-alert>
html
<!-- Boxed, brand surface, dual actions -->
<ore-alert docked="top" slim color="primary" variant="solid" dismissible style="--alert-max-width: 640px">
  20% off annual plans this week.
  <ore-button slot="actions" size="sm" variant="ghost">Get the deal</ore-button>
  <ore-button slot="actions" size="sm" variant="ghost">Learn more</ore-button>
</ore-alert>

Composed Banners ​

Anything can ride in the actions slot, so marketing banners compose from existing components instead of extra banner API. Newsletter capture:

html
<ore-alert slim color="secondary" dismissible>
  Weekly changelog, no spam.
  <div slot="actions" style="display:flex; gap: var(--size-2)">
    <ore-input size="sm" type="email" placeholder="you@example.com"></ore-input>
    <ore-button size="sm" color="primary" type="submit">Subscribe</ore-button>
  </div>
</ore-alert>

A countdown banner is the same shape: keep the remaining time in the text and update it from your own timer code.

Do not map banners to the role="banner" landmark — screen readers expect exactly one per page and it means the site header; the alert's own status role already announces it politely.

Full-Width Strip ​

An edge-to-edge notice strip across the page (in-flow, not pinned): full width, no radius, a tinted bordered surface, and horizontal actions on wide layouts.

Full width

API Reference ​

Attributes ​

AttributeTypeDefaultDescription
color'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'N/ATheme color
variant'flat' | 'solid' | 'bordered''flat'Visual style variant
size'sm' | 'md' | 'lg''md'Component size
rounded'none' | 'sm' | 'md' | 'lg' | 'full'N/ABorder radius override
headingstring''Bold heading above the message body
iconstringN/ALeading icon name; overrides the glyph derived from color, none disables it (see Icon)
dismissiblebooleanfalseShow a close (×) button
docked'top' | 'bottom'N/APin to a viewport edge as a site banner; full-bleed unless --alert-max-width is set
slimbooleanfalseSingle-line density: tighter padding; icon, text, and actions share one wrapping row
accentedbooleanfalseLeft accent border (flat/bordered variants only)
horizontalbooleanfalsePlace action buttons beside the content
embeddedbooleanfalseHost-managed mode: no live region or role, and dismiss fires immediately without the exit animation (used by ore-toast)

Slots ​

SlotDescription
(default)Alert message content
iconIcon on the leading edge. Hidden when empty: no reserved space.
metaSecondary info alongside the heading (lighter, right-aligned, smaller)
actionsAction buttons below the message, or beside it when horizontal is set

Events ​

EventDetailDescription
dismiss{ originalEvent: MouseEvent }Fired after the exit animation completes (immediately when embedded)

Properties ​

PropertyTypeDefaultDescription
labelsPartial<AlertLabels> (JS only)English defaultsAccessible strings: dismiss (close button name), dismissed (live announcement)
js
const alert = document.querySelector('ore-alert');
alert.labels = { dismiss: 'Hinweis schließen', dismissed: 'Hinweis geschlossen' };

CSS Parts ​

PartDescription
alertRoot container element
iconIcon wrapper
bodyBody flex container
headerHeading + meta row
headingHeading text span
metaMeta slot wrapper
contentDefault slot wrapper
actionsActions slot wrapper
closeDismiss button

CSS Custom Properties ​

PropertyDescriptionDefault
--alert-bgBackground colorTheme-dependent
--alert-colorText and icon colorTheme-dependent
--alert-border-colorBorder colorTheme-dependent
--alert-shadowBox shadowTheme-dependent
--alert-radiusBorder radiusvar(--rounded-lg)
--alert-paddingInternal paddingvar(--size-3) var(--size-4)
--alert-gapGap between icon, body, and closevar(--size-3)
--alert-font-sizeFont sizevar(--text-sm)
--alert-icon-sizeAutomatic leading icon sizevar(--size-5)
--alert-max-widthContent width for a boxed look100%
--alert-dock-insetDistance from viewport edges when docked (plus safe-area insets)var(--size-4)
--alert-dock-z-indexStacking order when dockedvar(--z-fixed)

Accessibility ​

The alert component follows WAI-ARIA best practices. It uses role="alert" with aria-live="polite" so screen readers announce the alert on insertion. When color="error", aria-live is set to assertive so urgent errors interrupt immediately; all other severities use polite. When dismissed, [dismissed] applies display: none, removing the element from the accessibility tree entirely.

The close button is keyboard-reachable and labeled through the dismiss label ("Dismiss alert" by default; announce text uses the dismissed label). The [dismissing] state disables pointer-events during the exit animation to prevent double-activation.

Dynamic insertion

Alerts injected into the DOM are announced automatically via role="alert". Avoid toggling color after insertion as it may trigger an unwanted re-announcement.