Skip to content

App ​

The host container for imperative APIs such as message / notification / loadingBar. When an app container exists, messages mount inside it (instead of document.body); works well with config-provider.

Basic usage ​

Wrapping content with <oas-app> makes imperative messages mount inside the app container.

Messages in the App container

Success messageError messageInfo messageNotificationLoading barClear messages

Working with ConfigProvider ​

app can be nested inside a config-provider to receive both the injected locale / size / theme and the message context.

ConfigProvider + App

Message (en)

Message / Notification global defaults ​

The message / notification attributes declare global default config for the imperative APIs (JSON; keys aligned with existing options). Imperative functions merge the nearest app's config with call options, and call options take precedence.

Message global defaults

Set global default (duration 800)Clear defaultDefault durationOverridden (5s)

API ​

oas-app ​

Attributes ​

AttributeDescriptionTypeDefault
messageGlobal default config JSON for the message imperative API (whitelisted keys: duration/closable/pauseOnHover/placement/offset/max/showProgress/showIcon/mask/repeatNum; group/key are runtime identifiers (onClose/onClick are functions), avatar/spinner/content are content keys, and icon counts as per-item customization — none are covered by global defaults); imperative functions merge the nearest app's config with call options, call options win; invalid JSON is ignored with a dev warning——
notificationGlobal default config JSON for the notification imperative API (keys aligned with existing options: duration/showProgress/progressPosition/scrollable); imperative functions merge the nearest app's config with call options, call options win; invalid JSON is ignored with a dev warning——
toastGlobal default config JSON for the imperative toast API (keys aligned with existing options keys: duration/position/closable/priority/max/politeness/variant/showProgress/progressRing/swipeDirection/grouping/stacked/pauseOnHover/pauseOnFocus/pauseOnWindowBlur); imperative calls merge the nearest app config with call arguments, call arguments win; invalid JSON is ignored with a dev warning——

Slots ​

NameDescription
defaultSubtree (imperative message stacks mount inside this container instead of document.body)
  • When an app container exists, the message stacks of imperative APIs like message / notification / loadingBar mount into the nearest app container.
  • Without an app container, behavior is unchanged and messages mount to document.body.
  • Nearest wins: the app container registered later (inner) takes precedence.

Released under the MIT OR Apache-2.0 License.