Anatomy
The aegov-banner component renders a full-width bar pinned to the top or bottom of the viewport, with a variant icon, message content, optional action buttons, and an optional dismiss control.

| Item | Name | Description |
|---|---|---|
1 |
Variant icon | Automatic icon matching the variant, or a custom icon slot |
2 |
Content | The slotted message text |
3 |
Actions | Optional row of buttons under the message via the actions slot |
4 |
Dismiss button | Closes the banner, shown unless is-dismissible="false" |
Every live preview on this page uses display="sticky" mode="overlay" inside a bounded, scroll-clipped container so the banners stay put for the demo instead of pinning to the real page viewport or shifting this page's own layout. The copy-paste code underneath each preview shows the real recommended defaults — display="fixed" mode="push" — which is what you should actually use in production.
Variants
The variant property sets the colour scheme and the implicit ARIA role. Only error resolves to role="alert"; success, info, warning, and default all resolve to role="status".
<aegov-banner variant="default">A neutral, informational message.</aegov-banner>
<aegov-banner variant="info">Useful information about your service.</aegov-banner>
<aegov-banner variant="success">Your Emirates ID renewal application has been received.</aegov-banner>
<aegov-banner variant="warning">Your residency permit expires in 14 days — renew before 15 May.</aegov-banner>
<aegov-banner variant="error">The payment gateway is temporarily unavailable.</aegov-banner>
import { AegovBanner } from '@aegov/designsystem-react';
export default function BannerVariants() {
return (
<>
<AegovBanner variant="default">A neutral, informational message.</AegovBanner>
<AegovBanner variant="info">Useful information about your service.</AegovBanner>
<AegovBanner variant="success">Your Emirates ID renewal application has been received.</AegovBanner>
<AegovBanner variant="warning">Your residency permit expires in 14 days — renew before 15 May.</AegovBanner>
<AegovBanner variant="error">The payment gateway is temporarily unavailable.</AegovBanner>
</>
);
}
<template>
<aegov-banner variant="default">A neutral, informational message.</aegov-banner>
<aegov-banner variant="info">Useful information about your service.</aegov-banner>
<aegov-banner variant="success">Your Emirates ID renewal application has been received.</aegov-banner>
<aegov-banner variant="warning">Your residency permit expires in 14 days — renew before 15 May.</aegov-banner>
<aegov-banner variant="error">The payment gateway is temporarily unavailable.</aegov-banner>
</template>
import { Component } from '@angular/core';
import { AegovBanner } from '@aegov/designsystem-angular';
@Component({
selector: 'app-banner-variants',
imports: [AegovBanner],
template: `
<aegov-banner variant="default">A neutral, informational message.</aegov-banner>
<aegov-banner variant="info">Useful information about your service.</aegov-banner>
<aegov-banner variant="success">Your Emirates ID renewal application has been received.</aegov-banner>
<aegov-banner variant="warning">Your residency permit expires in 14 days — renew before 15 May.</aegov-banner>
<aegov-banner variant="error">The payment gateway is temporarily unavailable.</aegov-banner>
`,
})
export class BannerVariantsComponent {}
Appearance
soft (default) uses a tinted background suitable for ongoing notices. solid uses a fully saturated colour panel for high-priority alerts that must dominate the viewport.
<aegov-banner appearance="soft" variant="warning">
Scheduled maintenance window starts at 22:00 tonight.
</aegov-banner>
<aegov-banner appearance="solid" variant="error">
Critical: identity verification service outage.
</aegov-banner>
import { AegovBanner } from '@aegov/designsystem-react';
export default function BannerAppearance() {
return (
<>
<AegovBanner appearance="soft" variant="warning">
Scheduled maintenance window starts at 22:00 tonight.
</AegovBanner>
<AegovBanner appearance="solid" variant="error">
Critical: identity verification service outage.
</AegovBanner>
</>
);
}
<template>
<aegov-banner appearance="soft" variant="warning">
Scheduled maintenance window starts at 22:00 tonight.
</aegov-banner>
<aegov-banner appearance="solid" variant="error">
Critical: identity verification service outage.
</aegov-banner>
</template>
import { Component } from '@angular/core';
import { AegovBanner } from '@aegov/designsystem-angular';
@Component({
selector: 'app-banner-appearance',
imports: [AegovBanner],
template: `
<aegov-banner appearance="soft" variant="warning">
Scheduled maintenance window starts at 22:00 tonight.
</aegov-banner>
<aegov-banner appearance="solid" variant="error">
Critical: identity verification service outage.
</aegov-banner>
`,
})
export class BannerAppearanceComponent {}
Position, display strategy, and mode
position (top | bottom) chooses which viewport edge the banner pins to. display chooses the CSS mechanism — fixed (default) stays glued to that edge regardless of scroll, sticky scrolls with the page until it reaches the edge, then sticks. mode chooses the layout strategy — push (default, only with display="fixed") adds matching padding to <body> so page content is never covered; overlay floats above content instead and emits aegovBannerHeightChange so you can react to its height yourself.
These three properties genuinely pin an element to the real page viewport and mutate <body>'s padding, so — matching the reference project's own documentation approach — this page does not attempt to live-preview them in isolation; every other live example on this page already demonstrates the safe display="sticky" mode="overlay" combination in a contained box. Use the code below directly in your own page to see real fixed/push behaviour.
<!-- Pinned to the bottom instead of the default top -->
<aegov-banner position="bottom" variant="default">
We use cookies to improve your experience. By continuing you accept our cookie policy.
</aegov-banner>
<!-- display: sticky — scrolls with the page, then sticks once it reaches the edge -->
<aegov-banner display="sticky" variant="warning">
Sticks once scrolled into place.
</aegov-banner>
<!-- mode: overlay — floats over content and reports its own height -->
<aegov-banner mode="overlay" position="top" variant="info" id="floatBanner">
This banner floats over content; subscribe to height changes for layout sync.
</aegov-banner>
<script>
document.getElementById('floatBanner')
.addEventListener('aegovBannerHeightChange', () => {
// With display="fixed" the host has no in-flow height, so measure the rendered bar.
const bar = document.querySelector('#floatBanner .aegov-banner');
document.body.style.setProperty('--banner-height', (bar ? bar.offsetHeight : 0) + 'px');
});
</script>
Size
The size property scales font size and vertical padding. Three tokens are available: sm, base (default), and lg.
<aegov-banner size="sm" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
<aegov-banner size="base" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
<aegov-banner size="lg" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
import { AegovBanner } from '@aegov/designsystem-react';
export default function BannerSizes() {
return (
<>
<AegovBanner size="sm" variant="info">UAE Pass authentication is now available for citizens and residents.</AegovBanner>
<AegovBanner size="base" variant="info">UAE Pass authentication is now available for citizens and residents.</AegovBanner>
<AegovBanner size="lg" variant="info">UAE Pass authentication is now available for citizens and residents.</AegovBanner>
</>
);
}
<template>
<aegov-banner size="sm" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
<aegov-banner size="base" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
<aegov-banner size="lg" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
</template>
import { Component } from '@angular/core';
import { AegovBanner } from '@aegov/designsystem-angular';
@Component({
selector: 'app-banner-sizes',
imports: [AegovBanner],
template: `
<aegov-banner size="sm" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
<aegov-banner size="base" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
<aegov-banner size="lg" variant="info">UAE Pass authentication is now available for citizens and residents.</aegov-banner>
`,
})
export class BannerSizesComponent {}
Responsive size
size can also be set per breakpoint using a responsive string. Only the three tokens above — sm, base, lg — are valid values at any breakpoint. Pick a value to preview what it resolves to.
<aegov-banner size="sm md:base xl:lg" variant="info">
Resizes with the viewport.
</aegov-banner>
import { AegovBanner } from '@aegov/designsystem-react';
export default function ResponsiveBanner() {
return (
<AegovBanner size="sm md:base xl:lg" variant="info">
Resizes with the viewport.
</AegovBanner>
);
}
<template>
<aegov-banner size="sm md:base xl:lg" variant="info">
Resizes with the viewport.
</aegov-banner>
</template>
import { Component } from '@angular/core';
import { AegovBanner } from '@aegov/designsystem-angular';
@Component({
selector: 'app-responsive-banner',
imports: [AegovBanner],
template: `
<aegov-banner size="sm md:base xl:lg" variant="info">
Resizes with the viewport.
</aegov-banner>
`,
})
export class ResponsiveBannerComponent {}
Actions
The actions slot holds buttons or links in a wrapping row under the message. When it has content, the message spans the full width instead of being centred as a block — the standard pattern for cookie consent or a call to action. aegov-button, aegov-link and plain links in the slot are recoloured to match the banner's variant and appearance.
<aegov-banner variant="info" position="bottom" is-dismissible="false">
We use cookies to improve your experience on the UAE Government services portal.
<div slot="actions">
<aegov-button size="sm">Accept all</aegov-button>
<aegov-button size="sm" appearance="outline">Manage preferences</aegov-button>
</div>
</aegov-banner>
import { AegovBanner, AegovButton } from '@aegov/designsystem-react';
export default function BannerActions() {
return (
<AegovBanner variant="info" position="bottom" isDismissible={false}>
We use cookies to improve your experience on the UAE Government services portal.
<div slot="actions">
<AegovButton size="sm">Accept all</AegovButton>
<AegovButton size="sm" appearance="outline">Manage preferences</AegovButton>
</div>
</AegovBanner>
);
}
<template>
<aegov-banner variant="info" position="bottom" is-dismissible="false">
We use cookies to improve your experience on the UAE Government services portal.
<div slot="actions">
<aegov-button size="sm">Accept all</aegov-button>
<aegov-button size="sm" appearance="outline">Manage preferences</aegov-button>
</div>
</aegov-banner>
</template>
import { Component } from '@angular/core';
import { AegovBanner, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-banner-actions',
imports: [AegovBanner, AegovButton],
template: `
<aegov-banner variant="info" position="bottom" [isDismissible]="false">
We use cookies to improve your experience on the UAE Government services portal.
<div slot="actions">
<aegov-button size="sm">Accept all</aegov-button>
<aegov-button size="sm" appearance="outline">Manage preferences</aegov-button>
</div>
</aegov-banner>
`,
})
export class BannerActionsComponent {}
Dismiss control
By default a close button renders. Set is-dismissible="false" for messages the user is not allowed to dismiss — legal notices, mandatory cookie consent. The close button runs a 300ms exit animation; aegovBannerDismiss fires once it completes. Click the close button below to try it.
<aegov-banner id="alertBanner" variant="warning">
Dismissible reminder — your residency expires in 14 days.
</aegov-banner>
<script>
document.getElementById('alertBanner')
.addEventListener('aegovBannerDismiss', () => {
console.log('User dismissed the renewal reminder');
});
</script>
import { AegovBanner } from '@aegov/designsystem-react';
export default function DismissibleBanner() {
return (
<AegovBanner
variant="warning"
onAegovBannerDismiss={() => console.log('User dismissed the renewal reminder')}
>
Dismissible reminder — your residency expires in 14 days.
</AegovBanner>
);
}
<template>
<aegov-banner variant="warning" @aegovBannerDismiss="onDismiss">
Dismissible reminder — your residency expires in 14 days.
</aegov-banner>
</template>
<script setup lang="ts">
function onDismiss() {
console.log('User dismissed the renewal reminder');
}
</script>
import { Component } from '@angular/core';
import { AegovBanner } from '@aegov/designsystem-angular';
@Component({
selector: 'app-dismissible-banner',
imports: [AegovBanner],
template: `
<aegov-banner variant="warning" (aegovBannerDismiss)="onDismiss()">
Dismissible reminder — your residency expires in 14 days.
</aegov-banner>
`,
})
export class DismissibleBannerComponent {
onDismiss() {
console.log('User dismissed the renewal reminder');
}
}
Critical alerts and heading association
Set is-focusable="true" for alerts that demand immediate attention — the banner focuses itself on mount. This only takes effect when the resolved role is alert, which variant="error" produces (or a role="alert" set on the host); it has no effect on success, info, warning, or default banners. Use it sparingly, since it interrupts the user's current keyboard focus.
There is no heading prop. To label the banner for assistive technology, set aria-labelledby on the host pointing at the id of a heading you render yourself inside the default slot — the attribute is copied to the inner banner element. field-id sets that inner element's own id.
This page does not auto-focus either example live, since stealing keyboard focus unexpectedly while reading documentation would itself be disruptive — the behaviour is exactly as described above when used on a real page.
<aegov-banner variant="error" is-focusable="true">
The Emirates ID renewal service is temporarily offline. Please try again in 30 minutes.
</aegov-banner>
<aegov-banner field-id="maintenance" aria-labelledby="maintenance-heading">
<strong id="maintenance-heading">Maintenance window</strong>
Government services will be briefly unavailable on Friday 03:00–05:00 GST.
</aegov-banner>
RTL support
The banner is direction-agnostic — internal spacing uses logical properties, so the icon (inline start) and the dismiss button (inline end) swap sides automatically under dir="rtl". The dismiss button's label is localised from the nearest dir ancestor or <html dir>: "Close banner" in English, "إغلاق الشريط" in Arabic.
<div dir="rtl">
<aegov-banner variant="warning">
تذكير: تنتهي صلاحية بطاقة الهوية الإماراتية الخاصة بك خلال 14 يوماً. يُرجى تجديدها قبل 15 مايو.
<div slot="actions">
<aegov-button size="sm">جدّد الآن</aegov-button>
<aegov-button size="sm" appearance="outline">تذكيري لاحقاً</aegov-button>
</div>
</aegov-banner>
</div>
import { AegovBanner, AegovButton } from '@aegov/designsystem-react';
export default function BannerRtl() {
return (
<div dir="rtl">
<AegovBanner variant="warning">
تذكير: تنتهي صلاحية بطاقة الهوية الإماراتية الخاصة بك خلال 14 يوماً. يُرجى تجديدها قبل 15 مايو.
<div slot="actions">
<AegovButton size="sm">جدّد الآن</AegovButton>
<AegovButton size="sm" appearance="outline">تذكيري لاحقاً</AegovButton>
</div>
</AegovBanner>
</div>
);
}
<template>
<div dir="rtl">
<aegov-banner variant="warning">
تذكير: تنتهي صلاحية بطاقة الهوية الإماراتية الخاصة بك خلال 14 يوماً. يُرجى تجديدها قبل 15 مايو.
<div slot="actions">
<aegov-button size="sm">جدّد الآن</aegov-button>
<aegov-button size="sm" appearance="outline">تذكيري لاحقاً</aegov-button>
</div>
</aegov-banner>
</div>
</template>
import { Component } from '@angular/core';
import { AegovBanner, AegovButton } from '@aegov/designsystem-angular';
@Component({
selector: 'app-banner-rtl',
imports: [AegovBanner, AegovButton],
template: `
<div dir="rtl">
<aegov-banner variant="warning">
تذكير: تنتهي صلاحية بطاقة الهوية الإماراتية الخاصة بك خلال 14 يوماً. يُرجى تجديدها قبل 15 مايو.
<div slot="actions">
<aegov-button size="sm">جدّد الآن</aegov-button>
<aegov-button size="sm" appearance="outline">تذكيري لاحقاً</aegov-button>
</div>
</aegov-banner>
</div>
`,
})
export class BannerRtlComponent {}
Usage
Here is the recommended usage of a banner on any website or application. These are recommended usage guides, however the developer must use the best practices of web and application development to accurately use this component.
Reserve it for page- or site-wide messages
A banner interrupts every page it appears on. Use it for something that affects the whole visit — an outage, a policy change, a deadline — not a single form's validation error.
Match variant to real severity
error interrupts screen reader users immediately. Reserve it for something the user must act on now; use info, success, or warning for everything else.
Let the user dismiss non-critical banners
Keep is-dismissible (the default) for anything the user doesn't strictly need to act on, so it doesn't keep occupying screen space after they've read it.
Do not stack more than one banner at a time
Multiple simultaneous banners compete for the same prime real estate and for the user's attention. Queue messages and show the single most important one instead.
Do not use a banner for content specific to one section of the page
A banner reads as applying to the whole page. Content scoped to one form, card, or section belongs in an aegov-callout instead.
Do not make critical, unmissable notices dismissible
Legal notices and mandatory consent messages should set is-dismissible="false" — a user who closes the message before reading it defeats its purpose.
API reference
The following are the properties and references of a banner
aegov-banner default properties
| Attribute | Description | Type | Default |
|---|---|---|---|
| DOM id for the inner banner element (the one carrying the role). Auto-generated ( |
| auto-generated |
| Colour scheme and implicit ARIA role. Only |
|
|
|
|
|
|
| Edge of the viewport the banner pins to. |
|
|
| CSS positioning strategy. |
|
|
|
|
|
|
| Font size and vertical padding. Accepts a single token or a Tailwind-style responsive string. |
|
|
| Whether a close button renders. |
|
|
| Gives the inner banner element |
|
|
Events
| Event | Description | Detail |
|---|---|---|
| Fires once the 300ms exit animation completes after the close button is clicked. |
|
| Fires in |
|
Slots
| Slot | Description |
|---|---|
(default) | Banner message content. |
| Action buttons or links, rendered in a wrapping row under the message. When present, the message spans the full width instead of being centred as a block. |
| Custom icon shown at the inline start, replacing the automatic variant icon. The icon column is always |
Pass-through attributes
| Attribute | Notes | Forwards to |
|---|---|---|
| Copied to the inner banner element; also stays on the host. | inner |
| Copied to the inner banner element; also stays on the host. | inner |
| When set on the host, overrides the auto-computed role (e.g. downgrade an | inner |
| Not forwarded. Use | n/a |
There is no heading prop. To label the banner for assistive technology, set aria-labelledby on the host pointing at the id of a heading you render yourself inside the default slot — the relationship is not created automatically.
Notes
The following notes are applicable of this component.
Built-in accessibility
- The role auto-computes from
variant— onlyerrorresolves torole="alert"(assertive, interrupts immediately);success,info,warning, anddefaultall resolve torole="status"(polite, announced when the screen reader is idle). - Neither role sets an explicit
aria-liveattribute — bothalertandstatuscarry theiraria-livevalue implicitly per the WAI-ARIA specification, which is the behaviour recommended by the APG Alert pattern. - A built-in variant icon renders automatically alongside the text, so severity is conveyed by shape as well as colour (WCAG SC 1.4.1). The icon column is
aria-hidden="true"— the slotted text is the sole accessible announcement. - The dismiss button has
aria-label="Close banner"("إغلاق الشريط"underdir="rtl") and its icon isaria-hidden="true". - In
display="fixed" mode="push", body padding is set and cleared automatically via aResizeObserverso page content is never hidden underneath, and is also cleared on dismiss and on disconnect.
Developer responsibility
The following is required for a developer to add additionally or pay attention to regarding this component.
- Choose
variantthoughtfully —role="alert"interrupts screen reader users immediately. Reserveerrorfor messages that genuinely require immediate attention. - There is no
headingprop. Settingaria-labelledbyon the host only creates the ARIA relationship — you must still render the heading element yourself inside the default slot with a matchingid. - Use
is-focusable="true"sparingly — it steals keyboard focus on mount, which is disruptive outside genuinely critical alerts, and only ever takes effect when the resolved role isalert. - Use only one
display="fixed" mode="push"banner per edge — each one writes<body>'s inlinepadding-toporpadding-bottomand overwrites any other inline value there. - A dismissed banner cannot be reopened: the host stays in the DOM, empty. Remove it and create a new element to show it again.
Additional notes
- The
sizeproperty is responsive-string capable (size="sm md:base xl:lg"), matching the same mechanism used by Badge and Accordion. mode="overlay"is intended for layouts that reserve their own space for the banner — subscribe toaegovBannerHeightChangeand apply the height to your own layout (a CSS custom property, for example) rather than relying on automatic body padding, which only applies inmode="push".
Keyboard support
| Key | Action |
|---|---|
Tab |
Move focus into the banner (any controls in the actions slot, then the dismiss button). |
Enter, Space |
Activate the focused control. |
Shift + Tab |
Move focus backwards. |