Skip to main content

Balloon

Support for Balloon notification is divided into two parts. Components for decoratively rendering a Balloon, and an API for showing balloon notifications imperatively (e.g. in response to events).

Remaining features

Declarative API

Components used for rendering a Balloon notification:

Balloon

Renders a single Balloon notification. Different parts of the balloon are passed as props. Timeout for hiding the balloon is not supported at this level. See useBalloonManager for that.

A tiny wrapper around Link component, to be used for actions in Balloon. It closes the balloon when pressed.

Note

How balloon notifications are stacked and positioned in bottom right, and an imperative API for triggering notifications is outside the scope of what this component is about. Use BalloonManager and useBalloonManager for that.

Live example

Result
Loading...
Live Editor

Expandable body

Body becomes expandable only if the content doesn't fit within the allowed number of lines. The expanded state can optionally be controlled.

Result
Loading...
Live Editor

Imperative API

BalloonManager

BalloonManager renders the necessary context for using useBalloonManager, as well as the stack of the notifications. By default it renders the notifications stack as a portal appended to body. This can be disabled by setting disablePortal to true. Either way, the notifications stack is an overlay placed at the bottom right of where it's rendered. If portal is disabled, position will be absolute, otherwise fixed.

useBalloonManager

useBalloonManager gives access to the imperative API for showing balloon notifications.

const { show, showSticky } = useBalloonManager();
Result
Loading...
Live Editor