@xsolla/xui-b2b-notification-panel
v0.232.0
Published
A full-width horizontal notification bar for persistent inline feedback within B2B page layouts. Stays in place until dismissed and is designed to sit inline within a page or panel rather than as a floating overlay.
Readme
NotificationPanel
A full-width horizontal notification bar for persistent inline feedback within B2B page layouts. Stays in place until dismissed and is designed to sit inline within a page or panel rather than as a floating overlay.
Two layout variants are available via the variant prop:
notification(default) — a taller banner with an icon frame on the left and a stacked title/description.announcement— a slim, single-line bar with an inline icon and the title/description on one row. Best for lightweight, page-level notices.
This is the canonical NotificationPanel. The former base package @xsolla/xui-notification-panel was removed — see Migration if you are coming from it.
Installation
npm install @xsolla/xui-b2b-notification-panelImports
import {
NotificationPanel,
type NotificationPanelProps,
type NotificationPanelDevice,
type ActionButtonElement,
} from '@xsolla/xui-b2b-notification-panel';Quick start
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
<NotificationPanel
type="success"
title="Changes saved"
description="Your settings have been updated successfully."
/>;API Reference
<NotificationPanel>
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| variant | "notification" \| "announcement" | "notification" | Layout. notification is the taller banner with an icon frame; announcement is the slim, single-line bar. |
| device | "desktop" \| "mobile" | "desktop" | Device layout. Mobile notification uses a three-column row (icon | stacked text + action | close). Mobile announcement puts icon and title on one row, description below, and groups action + close on the right (top-aligned). |
| type | "alert" \| "warning" \| "success" \| "neutral" \| "brand" | "neutral" | Visual tone of the panel. Controls background, default icon, and role. |
| title | string | — | Bold title text. |
| description | string | — | Secondary description text. |
| showIcon | boolean | true | Show or hide the icon (the icon frame for notification, the inline icon for announcement). |
| icon | ReactNode | — | Custom icon to replace the default type icon. Rendered as authored — the panel does not recolour it. |
| actionButton | ActionButtonElement | — | A Button, IconButton, or FlexButton element. The panel injects styling via cloneElement (see below). |
| showCloseButton | boolean | true | Show or hide the dismiss (×) button. |
| onClose | () => void | — | Called when the close button is pressed. |
| closeButtonAlign | "top" \| "center" | "center" | Vertical alignment of the action/close button group. Applies to the desktop notification variant only. |
| testID | string | — | Test ID for testing frameworks. |
Inherits ThemeOverrideProps (themeMode, themeProductContext).
ActionButtonElement
type ActionButtonElement = React.ReactElement<
ButtonProps | IconButtonProps | FlexButtonProps
>;The element passed to actionButton. The panel overrides a small set of props via cloneElement so the button matches the design; everything else (onPress, icon, children, etc.) is forwarded as authored:
FlexButton/Button—size="xs",variant="primary",background={false}(text-only XS action per Figma). PreferFlexButton.IconButton—size="xs"only.
Icon colour
The default type icon takes its colour from the surface it sits on, not from the type alone.
| Surface | Icon background | Glyph token |
| --- | --- | --- |
| Desktop notification frame — warning, success | background.warning.primary / background.success.primary — a solid light fill, the same value in light and dark | content.static.dark |
| Desktop notification frame — alert, neutral, brand | overlay.* over the panel background — follows the theme | content.primary |
| Mobile notification icon column | the panel background (no frame) | content.primary |
| announcement, both devices | background.*.secondary | content.primary |
content.static.dark is theme-independent (#000000 in every theme). It is required on the two filled frames because content.primary resolves to a near-white #e8eced in dark mode, which washes the glyph out against the light fill. Do not normalise these back to content.primary in a token sweep, and do not apply content.static.dark to the other rows — those surfaces are dark in dark mode, so it would be the inverse regression.
A custom icon is rendered exactly as authored; the panel does not recolour it.
See the Icon frame contrast — both themes story for a side-by-side check.
Examples
All types
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
<>
<NotificationPanel type="neutral" title="Info" description="Informational message." />
<NotificationPanel type="success" title="Success" description="Operation completed." />
<NotificationPanel type="warning" title="Warning" description="Please review before proceeding." />
<NotificationPanel type="alert" title="Error" description="Something went wrong." />
<NotificationPanel type="brand" title="New" description="A branded announcement." />
</>;With action button
Pass a FlexButton in size XS styling — the panel injects size="xs", variant="primary", and background={false}.
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
import { FlexButton } from '@xsolla/xui-button';
<NotificationPanel
type="warning"
title="Session expiring"
description="Your session will expire in 5 minutes."
actionButton={<FlexButton onPress={() => extendSession()}>Extend session</FlexButton>}
onClose={() => dismiss()}
/>;Mobile layout
On narrow viewports, pass device="mobile" for the Figma mobile layout: icon column on the left, title and description stacked in the center with the action below them, close button in the right column.
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
import { FlexButton } from '@xsolla/xui-button';
<NotificationPanel
device="mobile"
type="alert"
title="Alert notification"
description="A mutual NDA is required to begin your partnership with Xsolla"
actionButton={<FlexButton onPress={() => openNda()}>Button</FlexButton>}
onClose={() => dismiss()}
/>;Announcement variant
A slim, single-line bar. Pass a FlexButton as the action so it renders text-only.
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
import { FlexButton } from '@xsolla/xui-button';
<NotificationPanel
variant="announcement"
type="alert"
title="Alert notification"
description="Remove all product restrictions"
actionButton={<FlexButton onPress={() => openSettings()}>Button</FlexButton>}
onClose={() => dismiss()}
/>;With IconButton action
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
import { IconButton } from '@xsolla/xui-button';
import { ArrowRight } from '@xsolla/xui-icons-base';
<NotificationPanel
type="neutral"
description="View all available webhooks in the documentation."
actionButton={
<IconButton tone="mono" icon={<ArrowRight aria-hidden />} onPress={() => openDocs()} />
}
showCloseButton={false}
/>;Persistent (no close button)
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
<NotificationPanel
type="alert"
title="Payment failed"
description="Please update your billing information to continue."
showCloseButton={false}
/>;Without icon frame
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
<NotificationPanel
type="neutral"
title="Notice"
description="This notification has no icon."
showIcon={false}
/>;Top-aligned action/close buttons
Use closeButtonAlign="top" when the button group should align with the title instead of the default vertical centering.
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
<NotificationPanel
type="success"
title="Saved"
description="This is a neutral notification message"
closeButtonAlign="top"
onClose={() => dismiss()}
/>;Checking both themes at once
themeMode overrides the theme per instance — no nested provider needed. Useful when reviewing the filled icon frame.
import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';
<>
<NotificationPanel themeMode="light" type="warning" title="Warning — light" />
<NotificationPanel themeMode="dark" type="warning" title="Warning — dark" />
</>;Accessibility
role="alert"fortype="alert";role="status"for all other types.aria-labelon the root is"<type> <variant> <device>"(e.g."warning notification desktop","alert announcement mobile").- The close control is an icon-only
IconButton(variant="tertiary",tone="mono",size="xs",hoverBackground="none") witharia-label="Close notification". Uses Box/onPressso it works on React Native as well as web. - The default type icons are decorative — pass
aria-hiddenon any customiconyou supply. - The filled
warning/successicon frames pair acontent.static.darkglyph with a light fill (see Icon colour) so the icon keeps its contrast in both themes.
Migration
@xsolla/xui-notification-panel (base) has been removed. Swap the import — the prop surface here is a superset, so existing props keep working:
-import { NotificationPanel } from '@xsolla/xui-notification-panel';
+import { NotificationPanel } from '@xsolla/xui-b2b-notification-panel';If you consumed it through the @xsolla/xui-feedback bundle, NotificationPanel and NotificationPanelProps are no longer exported from there. Use @xsolla/xui-b2b (which re-exports this package) or import @xsolla/xui-b2b-notification-panel directly.
Three defaults differ, so expect small visual changes:
| | base (removed) | b2b |
| :-- | :-- | :-- |
| closeButtonAlign default | "top" | "center" — pass closeButtonAlign="top" to keep the old alignment |
| actionButton tone | panel injected a type-matched tone | never overridden — set tone on the button yourself |
| actionButton variant | defaulted to "secondary" | defaults to "primary" with background: false (text-only) — set variant/background explicitly to keep the old look |
This package also pulls in @xsolla/xui-typography and requires react-dom as a peer dependency.
