Flutter docs
Default skin

Notification

Prompt notification message globally.

When to use

To display a notification message at any of the four corners of the viewport. Typically it can be used in the following cases:

  • A notification with complex content.
  • A notification providing a feedback based on the user interaction. Or it may show some details about upcoming steps the user may have to follow.
  • A notification that is pushed by the application.

Examples

API

notification and notification.useNotification are exported from @ceebee/ui/client.

Notification

PropertyDescriptionTypeDefaultVersion
actionsCustomized button groupReactNode-5.24.0
btnCustomized close button group, please use actions insteadReactNode--
classNameCustomized CSS classstring--
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-—
closableWhether to show the close buttonboolean | ClosableTypetrue-
closeIconCustom close iconReactNodetrue5.7.0: close button will be hidden when setting to null or false
descriptionThe content of notification box (required)ReactNode--
durationTime in seconds before Notification is closed. When set to 0 or false, it will never be closed automaticallynumber | false4.5-
showProgressShow progress bar for auto-closing notificationboolean—5.18.0
pauseOnHoverkeep the timer running or not on hoverbooleantrue5.18.0
iconCustomized iconReactNode--
keyThe unique identifier of the Notificationstring--
titleThe title of notification boxReactNode-6.0.0
messageThe title of notification box (deprecated), please use title insteadReactNode--
placementPosition of Notification, can be one of top | topLeft | topRight | bottom | bottomLeft | bottomRightstringtopRight-
roleThe semantics of notification content recognized by screen readers. The default value is alert. When set as the default value, the screen reader will promptly interrupt any ongoing content reading and prioritize the notification content for immediate attention.alert | statusalert5.6.0
styleCustomized inline styleCSSProperties--
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-—
onClickSpecify a function that will be called when the notification is clickedfunction--
onCloseTrigger when notification closedfunction--
propsAn object that can contain data-*, aria-*, or role props, to be put on the notification div. This currently only allows data-testid instead of data-* in TypeScript. See https://github.com/microsoft/TypeScript/issues/28960.Object--
bottomDistance from the bottom of the viewport, when placement is bottom bottomRight or bottomLeft (unit: pixels)number24—
closeIconCustom close iconReactNodetrue5.7.0: close button will be hidden when setting to null or false
getContainerReturn the mount node for Notification() => HTMLNode() => document.body—
placementPosition of Notification, can be one of top | topLeft | topRight | bottom | bottomLeft | bottomRightstringtopRight—
showProgressShow progress bar for auto-closing notificationboolean—5.18.0
pauseOnHoverkeep the timer running or not on hoverbooleantrue5.18.0
rtlWhether to enable RTL modebooleanfalse—
stackNotifications will be stacked when amount is over thresholdboolean | { threshold: number }{ threshold: 3 }5.10.0
topDistance from the top of the viewport, when placement is top topRight or topLeft (unit: pixels)number24—
maxCountMax Notification show, drop oldest if exceed limitnumber-4.17.0

ClosableType

PropertyDescriptionTypeDefaultVersion
closeIconCustom close iconReactNodeundefined-
onCloseTrigger when notification closeFunctionundefined-

Global configuration

PropertyDescriptionTypeDefaultVersion
bottomDistance from the bottom of the viewport, when placement is bottom bottomRight or bottomLeft (unit: pixels)number24—
closeIconCustom close iconReactNodetrue5.7.0: close button will be hidden when setting to null or false
durationTime in seconds before Notification is closed. When set to 0 or null, it will never be closed automaticallynumber4.5—
getContainerReturn the mount node for Notification, but still display at fullScreen() => HTMLNode() => document.body—
placementPosition of Notification, can be one of top topLeft topRight bottom bottomLeft bottomRightstringtopRight—
showProgressShow progress bar for auto-closing notificationboolean—5.18.0
pauseOnHoverkeep the timer running or not on hoverbooleantrue5.18.0
rtlWhether to enable RTL modebooleanfalse—
topDistance from the top of the viewport, when placement is top topRight or topLeft (unit: pixels)number24—
maxCountMax Notification show, drop oldest if exceed limitnumber-4.17.0