Skip to content

Banner

The bq-banner component is a full-width, page-level announcement — maintenance notices, trial expiry, cookie policies.

Use bq-alert for messages scoped to a section of the page, and bq-toast for transient notifications.

Basic Usage

html
<bq-banner variant="info">Scheduled maintenance on Sunday, 02:00–04:00 UTC.</bq-banner>

Variants

html
<bq-banner variant="info">New workspace settings are available.</bq-banner>
<bq-banner variant="success">Your plan was upgraded.</bq-banner>
<bq-banner variant="warning">Your trial ends in 3 days.</bq-banner>
<bq-banner variant="danger">We could not process your last payment.</bq-banner>
<bq-banner variant="neutral">This workspace is read-only.</bq-banner>

Dismissible

html
<bq-banner variant="warning" dismissible>
  Your trial ends in 3 days.
</bq-banner>

bq-dismiss is cancelable. Call preventDefault() to keep the banner mounted — for example to persist the dismissal first, or to run your own exit animation:

js
banner.addEventListener('bq-dismiss', (event) => {
  event.preventDefault();
  savePreference('trial-banner-dismissed').then(() => banner.remove());
});

Icon and Actions

html
<bq-banner variant="warning" dismissible>
  <span slot="icon">⚠️</span>
  Your trial ends in 3 days.
  <bq-button slot="actions" size="sm">Upgrade</bq-button>
</bq-banner>

Sticky

html
<bq-banner variant="info" sticky>This banner stays at the top while scrolling.</bq-banner>

Properties

PropertyTypeDefaultDescription
variantstring'info'info | success | warning | danger | neutral
dismissiblebooleanfalseShow a dismiss button
stickybooleanfalseStick to the top of the viewport
labelstring''Accessible label for the banner region

Slots

SlotDescription
(default)Banner message
iconLeading icon
actionsTrailing actions

Events

EventDetailCancelableDescription
bq-dismissYesThe dismiss button was activated

CSS Parts

PartDescription
bannerThe banner container
iconIcon wrapper
contentMessage wrapper
actionsActions wrapper
dismissThe dismiss button

Accessibility

  • The danger variant renders role="alert" with aria-live="assertive" so failures interrupt; every other variant uses role="status" with aria-live="polite".
  • Set label when the banner needs a name distinct from its text content.
  • Keep the dismiss button reachable: it is a real <button> with an aria-label and a visible focus ring.

Released under the MIT License.