Skip to content

Message ​

Message shows global toast feedback via an imperative API. Wrap the app (or each demo) in <gk-message-provider>; call gkMessage to create, update lifecycle with destroy() / destroyAll(). Unlike Alert, Message owns its lifecycle and removes itself from the queue.

Demos ​

Basic

Trigger gkMessage.info, success, warning, and error. Requires a connected gk-message-provider.
InfoSuccessWarningError

Types

Types: default, info, success, warning, error, and loading. Loading defaults to no auto-dismiss; this demo destroys the handle after 2s.
DefaultInfoSuccessWarningErrorLoading (2s)

Closable

Pass { closable: true } per call (or set closable on the provider). Close removes the message from the queue.
Closable message

Duration

Override duration per call. Provider default is 3000 ms; 0 means no auto-dismiss.
1 secondDuration 0

Placement

Set placement on this demo’s provider only. Values: top, top-left, top-right, bottom, bottom-left, bottom-right.
Bottom right

Destroy all

gkMessage.destroyAll() dismisses every message on the active provider.
InfoSuccessWarningDestroy all

API ​

gk-message-provider Props ​

PropTypeDefault
placement'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right''top'
durationnumber3000
closablebooleanfalse
keep-alive-on-hoverbooleanfalse
maxnumber—

gk-message-provider Slots ​

NameDescription
defaultApplication / page content

gkMessage ​

Imported from @gk-ui/core. Requires a connected <gk-message-provider>.

MethodSignatureNotes
create(content: string, options?: GkMessageOptions) => GkMessageReactiveGeneric create
info(content: string, options?: GkMessageOptions) => GkMessageReactivetype: 'info'
success(content: string, options?: GkMessageOptions) => GkMessageReactivetype: 'success'
warning(content: string, options?: GkMessageOptions) => GkMessageReactivetype: 'warning'
error(content: string, options?: GkMessageOptions) => GkMessageReactivetype: 'error'
loading(content: string, options?: GkMessageOptions) => GkMessageReactivetype: 'loading'; default duration: 0
destroyAll() => voidDismiss all on the active provider

GkMessageOptions: type, duration, closable, keepAliveOnHover, showIcon (default true).

GkMessageReactive: { destroy: () => void }.

gk-message Props ​

PropTypeDefault
type'default' | 'info' | 'success' | 'warning' | 'error' | 'loading''default'
contentstring''
closablebooleanfalse
show-iconbooleantrue

gk-message Events ​

NameDescription
gk-closeClose control activated; bubbles; composed: true

CSS Parts (gk-message) ​

PartDescription
baseOuter surface
iconIcon / spinner column
contentText content
closeClose button