Skip to main content
BEEQ Alert component overview
Alert is a lightweight message surface for conveying status, progress, or required next steps in a clear and consistent way.

When to use

Use alerts when
  • You need to clearly and concisely convey important information
  • A message applies to a page, card, section, or system-level state
  • Users need feedback after submitting data, changing permissions, or completing an action
  • Users need to know about errors, warnings, maintenance, upgrades, or time-sensitive tasks

Do not use alerts when
  • The alert would disrupt a critical task
  • The message overlaps essential content or important interface controls
  • Its presence could confuse users or compete with a more relevant inline message
  • A toast, notification, or field-level validation message would be more precise

Patterns

Alerts can be used at different scopes, depending on what the message affects.

Anatomy

BEEQ Alert component anatomy
PartElementDescription
1ContainerThe alert surface that groups the message, icon, title, and actions
2IconStatus icon, or a custom icon when the alert uses the default type
3TitleThe alert title content in the default slot
4Close buttonDismisses the alert unless disable-close is set
5DescriptionOptional supporting content in the body slot
6CTA buttonOptional action content in the footer slot

Design guidelines

Types

Set border to match the surface where the alert appears. Use the same radius scale as the surrounding layout.

Usage

Default

Use the default variant for general-purpose alerts. It lets you customize the bq-icon for messages with no associated severity.
Set open to show the alert. Use show() and hide() when visibility is controlled programmatically.
Alert fills the width of its parent container.

Info

Use the info variant when users need additional, non-critical information. It works well for context that helps users understand a state without requiring immediate action.

Success

Use the success variant to notify users about successful actions or positive outcomes. This type of alert is ideal for celebrating achievements, completed processes, or any operation that concludes successfully.

Warning

Use the warning variant to indicate potential issues or actions that users should approach with caution. This alert helps draw attention to situations that require careful consideration but may not be critical.

Error

Use the error variant for issues that require immediate attention. It works best for problems that block the task or prevent a successful outcome.

Options

Sticky

Use the sticky attribute for persistent alerts that remain visible until users dismiss them. Sticky alerts work well for ongoing information that needs prolonged attention, such as system updates or maintenance notices.
Sticky alerts support every alert type: default, success, error, warning, and info.
Sticky alerts use a preset layout with the alert text centered at the top of the screen.

Auto-dismiss

Set auto-dismiss to hide the alert automatically after a delay. Use time to override the default 3000 ms. Set a minimum of 8000 ms for alerts with meaningful content so users have enough time to read the message.
Do not use auto-dismiss for alerts that contain errors, required actions, or legal information.

Best practices

DoPlace alerts close to the content or workflow they affect.

Don’tDo not place alerts where they hide controls or interrupt a critical task.

DoWrite a short title that explains the state, then add body text only when users need context.

Don’tDo not use long paragraphs or unrelated links inside an alert.

DoGive users enough time to read auto-dismiss alerts and keep important messages dismissible by intent.

Don’tDo not auto-dismiss alerts that contain errors, required actions, or legal information.

DoMatch the alert type, icon, and action style to the severity of the message.

Don’tDo not mix severity colors or custom icons in ways that make the alert harder to scan.

Accessibility

  • The host uses role="alert" so assistive technologies announce the message when it appears.
  • The host sets aria-hidden from the open state, keeping hidden alerts out of the accessibility tree.
  • The default close button has the accessible label “Close alert.”
  • type provides visual intent and a matching predefined status icon for info, success, warning, and error.
  • Provide a concise title in the default slot and supporting details in the body slot when users need more context.
  • The built-in type tokens (info, success, warning, error) meet WCAG AA color-contrast requirements in both light and dark themes. Verify contrast manually when using custom colors via CSS variables.
  • All interactive elements inside the alert — the close button, footer actions, and body links — must be reachable via Tab and have a visible focus indicator.
  • Set time to a minimum of 8000 ms for auto-dismiss alerts. Do not auto-dismiss while the user has keyboard focus or hover inside the alert.
  • When sticky is enabled, keep the page focus order logical so keyboard users can still reach the affected content.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
autoDismissauto-dismissIf true, the alert will automatically hide after the specified amount of timebooleanfalse
borderborderThe corner radius of the alert component'none' | 'xs2' | 'xs' | 's' | 'm' | 'l' | 'full''s'
disableClosedisable-closeIf true, the close button at the top right of the alert will not be shownbooleanfalse
hideIconhide-iconIf true, the alert icon will not be shownbooleanfalse
openopenIf true, the alert will be shownbooleanfalse
stickystickyIf true, the alert remains fixed at the top of the page, occupying the full viewport widthbooleanfalse
timetimeThe length of time, in milliseconds, after which the alert closes itself. Only valid when auto-dismiss is setnumber3000
typetypeType of alert'default' | 'error' | 'info' | 'success' | 'warning''default'

Events

EventDescriptionType
bqHideFires when the alert starts to hideCustomEvent<any>
bqShowFires when the alert starts to showCustomEvent<any>
bqAfterHideFires after the alert has been hiddenCustomEvent<any>
bqAfterShowFires after the alert has been shownCustomEvent<any>
  • In React, prefix events with on: onBqShow, onBqHide, onBqAfterShow, onBqAfterHide.
  • In Angular, use the event binding syntax: (bqShow), (bqHide), (bqAfterShow), (bqAfterHide).
  • In Vue, use the @ shorthand: @bqShow, @bqHide, @bqAfterShow, @bqAfterHide.

Methods

MethodDescriptionType
show()Shows the alert componentPromise<void>
hide()Hides the alert componentPromise<void>

Slots

SlotDescription
(default)The alert title content
bodyThe alert description content
footerThe alert footer content
iconCustom icon content. Status types render predefined icons when this slot is empty
btn-closeCustom close button content

Shadow parts

PartDescription
baseThe <div> container of the predefined bq-icon component
bodyThe container <div> that wraps the alert description content
btn-closeThe native button of the bq-button used to close the alert
contentThe container <div> that wraps all alert content: title, description, and footer
footerThe container <div> that wraps the alert footer content
iconThe <bq-icon> element used to render a predefined icon based on the alert type
icon-outlineThe container <div> that wraps the icon element
mainThe container <div> that wraps the alert main content
svgThe <svg> element of the predefined bq-icon component
titleThe container <div> that wraps the alert title content
wrapperThe wrapper container <div> inside the shadow DOM

CSS custom properties

Resources

Use Storybook to test behavior and states interactively, or review the source if you need implementation details.

Interactive playground

Explore all alert configurations in Storybook

Source code

View the component source on GitHub