Skip to content

Alert ​

An inline notice bar for success, info, warning, or error messages, with support for a title, description, icon, action area, close animation, and multiple variants.

Basic usage ​

Four types

This is a regular info messageThe operation completed successfullyPlease save your current progressOperation failed, please try again later

No title ​

No title

An alert with only body content and no title line.

Icon ​

icon shows the default icon for the type; slot="icon" overrides it with custom content; prominent scales the icon up one step (combined with icon or banner).

Icon (icon)

An info notice with an iconThe operation completed successfullyPlease save your current progressOperation failed, please try again later

Custom icon (slot=icon)

🚀 Replace the default icon via slot="icon" — any icon or image works.

Large icon (prominent)

⚠️Clean up now Only 1.2GB of free space remains, please clean up your cache.

Description ​

The description attribute or slot="description" renders a description line between the title and the body, coexisting with the default slot content.

Description (description)

Please save your work in advance. The system recovers automatically after maintenance. This is a slot description with rich content. An alert with only a slot description and no title.

Action area ​

slot="action" renders an action area on the right (buttons such as view details, undo, etc.); when combined with the close button, it sits to the left of the close button.

Action area (slot=action)

Update nowLater Version v2.4.0 is available with performance improvements and bug fixes.

Variants ​

variant supports three styles: tint (default, tinted background + border), filled (solid type color with contrasting text), and outlined (transparent background + type-colored border).

Variants (variant)

The default look: tinted background + same-color border.Solid type color background; text switches to a contrasting color.Transparent background + type-colored border.

banner removes the border and border radius for a full-width strip, and shows the type icon by default (combined with icon); commonly used with center for a centered page-top banner.

Banner (banner + center)

The platform will undergo system upgrade on Saturday 00:00 - 06:00, please plan accordingly.

Closable banner

Abnormal traffic detected; some requests were blocked. Please verify your account security.

Centered ​

center horizontally centers the text area (title / description / body), commonly used with banners and plain text notices.

Centered (center)

The content area is horizontally centered.

Closable ​

Closable

Click the ✕ on the right to close this alertA closable alert without a title

Close animation & controlled visibility ​

Closing plays a fade-out transition and dispatches oas-after-close when done. The open attribute controls visibility (open by default); after closing, the component removes open and dispatches oas-open-change, and the host can re-open it by setting open again. With prefers-reduced-motion, the transition is skipped and the alert hides directly.

Close animation (controlled reopen)

Reopen noticeClick ✕ to close; use the button above to reopen after the animation.

Controlled visibility (open)

Open (set open)Close (remove open)External buttons set / remove open to control visibility, with the same exit transition.

Custom close ​

close-text replaces the ✕ text (and becomes the button's accessible name); slot="close" provides rich custom close content.

Custom close (close-text)

Click "Got it" on the right to close.

Custom close (slot=close)

Replaces the default ✕ with an icon; click to close.

Collapse ​

The numeric max-line attribute truncates the body with CSS line-clamp, and provides an expand / collapse toggle.

Collapse (max-line)

This release brings several improvements: a brand-new theme customization panel, faster list rendering, configurable keyboard shortcuts, and a wide range of accessibility enhancements. It also fixes several known issues, including table overflow on narrow screens and popup misalignment on low resolutions. See the full changelog for details.

Accent border ​

The border attribute renders a type-colored accent bar on the corresponding side(s). Values are space-separated: top / end / bottom / start.

Accent border (border)

The accent bar is rendered on the top.Multiple sides can be combined.

Sizes ​

size supports three steps: small / medium (default) / large, scaling font size and padding.

Sizes (size)

For compact scenarios.The regular size.For featured scenarios.

Event feedback ​

Event feedback

Dispatches oas-close when closed and oas-open-change on visibility changes.

API ​

oas-alert ​

Attributes ​

AttributeDescriptionTypeDefault
bannerBanner mode: no border/radius, full-width; shows icon by defaultboolean—
borderAccent bars: space-separated top/end/bottom/start (logical sides, RTL-aware) rendering a type-color barstring—
centerCenter the text area horizontally (title/description/body); often combined with bannerboolean—
close-textClose button text (replaces the default ✕); rich custom content via slot="close"string—
closeableWhether to show the close buttonboolean—
descriptionSecondary text below the title; rich content via slot="description"string—
iconShow the default icon for the type (info/success/warning/error); override via slot="icon"boolean—
max-lineMax body lines: clamp with CSS line-clamp and show an expand/collapse toggle; not set = no clampingstring0
openControlled visibility (default true): set to false on close with oas-open-change dispatched; set true again to reopenboolean—
prominentLarge icon: enlarge the icon one step (works with icon)boolean—
sizeSize: small/medium/large (default medium) scaling font size and paddingstringmedium
titleTitle text (rendered into the visible title region; absorbed from the host on read so no native hover tooltip remains; pass an empty string to clear); use the "title" slot for rich contentstring—
typeAlert typestringinfo
variantVisual variant: tint (default, light bg + matching border) / filled (solid type color + on-color text) / outlined (transparent bg + type color border)stringtint

Events ​

EventDescription
oas-after-closeDispatched after the closing transition ends (also dispatched when prefers-reduced-motion skips the transition)
oas-closeDispatched after the close button is clicked; the component then hides
oas-open-changeDispatched when visibility changes, detail

Slots ​

NameDescription
defaultBody content slot
actionRight-side action slot (e.g. "View details"/"Undo" buttons); placed left of the close button when both present
closeRich custom close element, overrides ✕ and close-text; aria-label still falls back to close-text/locale
descriptionRich description slot; overrides the description attribute when present
iconIcon slot; overrides the default type icon
titleRich title content slot; overrides the title attribute text when present

CSS Variables ​

CSS VariableDefault
--oas-alert-max-line2

Released under the MIT OR Apache-2.0 License.