PageBanner
A versatile notification banner component with multiple types, dismissible behavior, auto-dismiss timers, page-level portals, and action buttons.
Basic Usage
Banner Types
PageBanner supports five types: info, success, warning, error, and default.
import { PageBanner } from 'fluxo-ui';
<PageBanner type="info" message="This is an informational banner." />
<PageBanner type="success" message="Operation completed successfully!" />
<PageBanner type="warning" message="Please review before proceeding." />
<PageBanner type="error" message="Something went wrong. Please try again." />
<PageBanner type="default" message="This is a default banner." />Dismissible
Control how banners are dismissed — manually via close button, automatically with a timer, or not at all.
Dismissible Banner
Banners can be dismissed by clicking the close button.
import { PageBanner } from 'fluxo-ui';
const [visible, setVisible] = useState(true);
<PageBanner
type="info"
message="Click the X to dismiss this banner."
dismissible
visible={visible}
onDismiss={() => setVisible(false)}
/>Auto-Dismiss
Banners can auto-dismiss after a set duration with a progress bar indicator.
import { PageBanner } from 'fluxo-ui';
<PageBanner
type="success"
message="This banner will auto-dismiss in 5 seconds."
autoDismiss={5000}
onDismiss={() => console.log('Dismissed!')}
/>Non-Dismissible
Set dismissible to false to prevent the user from closing the banner.
Page Level & Bordered
Use pageLevel to render the banner at the top of the page via createPortal, or bordered for a left accent border.
Page-Level Banner
Page-level banners use createPortal to render at the top of the page, above all other content.
import { PageBanner } from 'fluxo-ui';
<PageBanner
type="error"
message="Service maintenance scheduled for tonight."
pageLevel
onDismiss={() => setVisible(false)}
/>Bordered Banner
Add a left border accent using the bordered prop.
import { PageBanner } from 'fluxo-ui';
<PageBanner
type="info"
message="Bordered banner with a left accent."
bordered
/>With Actions
Add action buttons using the actions prop for interactive banners.
Banner with Actions
Add action buttons using the actions prop to let users take immediate action.
import { PageBanner, Button } from 'fluxo-ui';
<PageBanner
type="warning"
title="Update Available"
message="A new version is available."
actions={
<div className="flex gap-2">
<Button size="sm" variant="primary">Update Now</Button>
<Button size="sm" variant="default">Later</Button>
</div>
}
/>Custom Content
Customize icons, titles, and message content with rich JSX.
Custom Icons
Provide a custom icon via the icon prop to replace the default type-based icon.
import { PageBanner } from 'fluxo-ui';
<PageBanner
type="info"
title="Custom Title"
message={<span>Rich <strong>HTML</strong> content in the message.</span>}
icon={<CustomIcon />}
/>
<PageBanner
type="success"
message="Banner without an icon."
showIcon={false}
/>Rich Message Content
The message prop accepts ReactNode, allowing rich HTML content.
Without Icon
Set showIcon to false to hide the icon entirely.
With Title
Add a title to give the banner a bold heading above the message.
Import
import { PageBanner } from 'fluxo-ui';
import type { PageBannerProps, BannerType, BannerPosition } from 'fluxo-ui';Props
type'info' | 'success' | 'warning' | 'error' | 'default'"'info'"The visual style of the banner.
type'info' | 'success' | 'warning' | 'error' | 'default'"'info'"The visual style of the banner.
messagereqReactNodeThe main content of the banner. Accepts text or JSX.
messagereqReactNodeThe main content of the banner. Accepts text or JSX.
titlestringAn optional bold heading displayed above the message.
titlestringAn optional bold heading displayed above the message.
headingLevel1 | 2 | 3 | 4 | 5 | 6"3"Heading element used for the title (h1-h6) so the page heading outline includes the banner.
headingLevel1 | 2 | 3 | 4 | 5 | 6"3"Heading element used for the title (h1-h6) so the page heading outline includes the banner.
iconReactNodeCustom icon to replace the default type-based icon.
iconReactNodeCustom icon to replace the default type-based icon.
showIconboolean"true"Whether to display an icon in the banner.
showIconboolean"true"Whether to display an icon in the banner.
dismissibleboolean"true"Whether the banner can be dismissed via a close button.
dismissibleboolean"true"Whether the banner can be dismissed via a close button.
autoDismissnumberAuto-dismiss after this many milliseconds. Shows a progress bar.
autoDismissnumberAuto-dismiss after this many milliseconds. Shows a progress bar.
onDismiss() => voidCallback fired when the banner is dismissed.
onDismiss() => voidCallback fired when the banner is dismissed.
visibleboolean"true"Controls the visibility of the banner externally.
visibleboolean"true"Controls the visibility of the banner externally.
position'top' | 'inline'"'inline'"Position of the banner. Top sticks to viewport top.
position'top' | 'inline'"'inline'"Position of the banner. Top sticks to viewport top.
pageLevelboolean"false"When true, renders the banner via createPortal to document.body.
pageLevelboolean"false"When true, renders the banner via createPortal to document.body.
pushContentboolean"false"When combined with pageLevel, pushes page content down.
pushContentboolean"false"When combined with pageLevel, pushes page content down.
classNamestringAdditional CSS class name for custom styling.
classNamestringAdditional CSS class name for custom styling.
actionsReactNodeAction buttons or elements rendered alongside the message.
actionsReactNodeAction buttons or elements rendered alongside the message.
borderedboolean"false"Adds a left border accent matching the banner type color.
borderedboolean"false"Adds a left border accent matching the banner type color.
restoreFocusOnDismissboolean"true"On dismiss, return focus to the element that was focused when the banner appeared.
restoreFocusOnDismissboolean"true"On dismiss, return focus to the element that was focused when the banner appeared.
Features
Five Banner Types
Info, success, warning, error, and default types with distinct colors and icons.
Dismissible
Banners can be dismissed manually via close button or automatically after a timer.
Auto-Dismiss
Set a timer with a progress bar indicator that auto-dismisses the banner.
Page-Level Portal
Render banners at the top of the page using createPortal for global notifications.
Action Buttons
Include action buttons alongside the message for immediate user interaction.
Accessible
Uses role="alert" and aria-live="polite" for screen reader compatibility.