Notification
Notification shows a short status message without blocking the page. Render it inline (type="block"), as a
full-width page banner (type="page"), or as a stacked toast through useNotification(). Inline and banner
notifications are controlled: you hide them with visible={false}.When to use
- You report the result of an action: saved, failed, needs attention.
- The message must coexist with the current flow instead of interrupting it.
- Feedback arrives asynchronously; add
autoCloseso the toast dismisses itself.
- A single form field is invalid — use the field's own error message.
- The user must respond before continuing — use
Modal.
Usage
Notification title
Complementary message detailing the notice.
const [visible, setVisible] = useState(true);
<Notification
visible={visible}
onDismiss={() => setVisible(false)}
variant="primary"
icon={<Icon icon={cog} />}
title="Notification title"
message="Complementary message"
/>;The close button (shown by default; closable={false} hides it) and autoClose only call onDismiss.
Variants
variant sets the palette: primary (default), success, warning, danger.
Success
Operation completed
Warning
Attention required
Danger
Something went wrong
action takes a node or ({ close }) => node; its color follows variant. close is your onDismiss, so call
it yourself — the action does not close the notification.
Notification with action
The action renders on the right.
<Notification
title="Session expiring"
message="Your session ends in one minute."
onDismiss={hide}
action={({ close }) => (
<Button
size="small"
text="Renew"
onClick={() => {
renew();
close();
}}
/>
)}
/>type="page" portals a full-bleed banner to the top or bottom edge (pagePosition, default bottom). Pass
pageOffset (the app-bar height) so a top banner sits under the chrome instead of covering it.
Toasts
ApollionProvider mounts the toast provider, so any component below it can call useNotification().
import { useNotification } from '@apollion-dsi/core/containers/notification';
function SaveButton() {
const { showNotification } = useNotification();
const notify = () =>
showNotification({ title: 'Saved', message: 'Your changes are live.', variant: 'success', autoClose: 5 });
return <Button text="Save" onClick={notify} />;
}- Toasts stack in the bottom-right corner. At most three stay open: a fourth removes the oldest.
autoCloseis in seconds and draws a progress bar that pauses on hover. Without it, the toast stays until closed.- A toast closed by its button,
autoCloseorclose()animates out before it leaves the queue.
Accessibility
dangerrendersrole="alert"(aria-live="assertive"); the other variants renderrole="status"(polite).aria-atomic="true"reads the title and message as one announcement.closeLabelnames the close button (default'Fechar notificação'). Localize it, and make it specific when several notifications share the screen.- Do not make an
autoClosetoast the only route to critical information or to an action.
Properties
actionReactNode((p: { close: () => void; }) => ReactNode)nullalignContent"center""start""end""between""around""evenly""stretch"noneautoClosenumbernullclosablebooleantruecloseLabelstringFechar notificaçãocontainmentstringnonecqPartial<Record<ContainerSizeTypes, Partial<Omit<Partial<{ area: string; padding: stringnumber; margin: stringnumber; isHidden: boolean; truncate: boolean; lineClamp: number; pageShell: boolean; ... 14 more ...; transform: string; }>, "containment"> & Partial<...> & SizeFactoryProps & Partial<...>>>>noneenableBreakpoint"xs""xl""sm""md""lg"noneiconReactNodenullignoreResponsivebooleannonejustifyItems"center""start""end""stretch"nonelineClampnumbernonelink{ text: string; href?: string; to?: any; }undefinednonemessageReactNode((p: { close: () => void; }) => ReactNode)nullmotion"none""fade""scale""slide-up""slide-down""slide-left""slide-right""collapse""sheet""sheet-top""drawer-left""drawer-right""push-left""push-right"noneonDismiss(() => void)nonepageOffsetstringnumber0pagePosition"top""bottom"'bottom'pageShellbooleannoneplaceItems"center""start""end""stretch"nonetitlestringnonetransformstringnonetype"block""page"blockvariant"primary""success""warning""danger"primaryviewportMediasPartial<Record<keyof BreakPoint<any>, Partial<Omit<Partial<{ area: string; padding: stringnumber; margin: stringnumber; isHidden: boolean; truncate: boolean; lineClamp: number; pageShell: boolean; ... 14 more ...; transform: string; }>, "containment"> & Partial<...> & SizeFactoryProps & Partial<...>>>>undef...nonevisiblebooleantrueAlso accepts the layout props.