Skip to content

Displays an important message with a semantic variant, an optional icon and an optional close button.

[atlasAlertDescription][atlasAlertTitle][atlasAlert]

Examples

Variants

Put an atlas-icon first and it sits beside the title; the variant colours the border, tint and icon, while the text stays readable on every tint.

Heads up

You can add components from the CLI.

New version

Version 2.4 is available.

Saved

Your changes are live.

Storage almost full

90% of your quota is used.

Payment failed

Update your card to continue.

Dismissible

dismissible adds a close button that hides the alert and emits (dismissed) . The alert held focus on its close button, so the handler moves focus somewhere sensible.

New version available

Reload the page to get the latest features.

Announcements

live sets how screen readers announce an alert: polite (default, role="status" ) waits its turn, assertive ( role="alert" ) interrupts for errors that need action, off is for messages that are part of the page from the start.

API

Generated from the library source, so it always matches the code.

AtlasAlertComponent [atlasAlert]

InputTypeDefaultDescription
variant AlertVariants['variant']'default' Status colour: default , info , success , warning or destructive . The title must also say the status: colour alone is not enough.
live AlertLive'polite' How screen readers announce the alert: polite ( role="status" ), assertive ( role="alert" ) or off .
dismissible booleanfalse Shows a close button; clicking it hides the alert and emits dismissed .
dismissLabel string | undefinedundefined Accessible name of the close button. Defaults to the configured alert.dismiss text.
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.
OutputPayloadDescription
dismissedvoid Emits when the close button hides the alert. Move focus here if the alert held it.

AtlasAlertTitleDirective [atlasAlertTitle]

InputTypeDefaultDescription
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.

AtlasAlertDescriptionDirective [atlasAlertDescription]

InputTypeDefaultDescription
class string'' Extra CSS classes, merged with the component's own through cn() ; yours win on conflicts.

Types

AlertLive

How the alert is announced. polite ( role="status" ) waits for the screen reader to finish; assertive ( role="alert" ) interrupts, for errors that need action now; off sets no role, for a message that is part of the page from the start.

type AlertLive = 'polite' | 'assertive' | 'off'

AlertVariants

type AlertVariants = VariantProps<typeof alertVariants>