createToast

function

createToast(props?): ToastWidget

Create an ToastWidget with given config props

Parameters

props?: PropsConfig<ToastProps>

Returns

ToastWidget

an ToastWidget


getToastDefaultConfig

function

getToastDefaultConfig(): ToastProps

Retrieve a shallow copy of the default Toast config

Returns

ToastProps

the default Toast config


ToastApi

interface
Methods
close

close(): void

Triggers alert closing programmatically (same as clicking on the close button (×)).

Returns

void


open

open(): void

Triggers the alert to be displayed for the user.

Returns

void


ToastBodyDirective

class
Constructors
new ToastBodyDirective

new ToastBodyDirective(): ToastBodyDirective

Returns

ToastBodyDirective

Properties
templateRef

templateRef: TemplateRef<any>

Methods
ngTemplateContextGuard

static ngTemplateContextGuard(dir, context): context is ToastContext

Parameters

dir: ToastBodyDirective

context: unknown

Returns

context is ToastContext


ToastComponent

class
Implements
Constructors
new ToastComponent

new ToastComponent(): ToastComponent

Returns

ToastComponent

Properties
_widget

readonly _widget: AngularWidget<ToastWidget>


animated

animated: undefined | boolean

If true, alert closing will be animated.

Animation is triggered when clicked on the close button (×), via the .close() function or the visible prop is changed

Default Value

true


animatedOnInit

animatedOnInit: undefined | boolean

If true, alert opening will be animated.

Animation is triggered when the .open() function is called or the visible prop is changed

Default Value

false


ariaCloseButtonLabel

ariaCloseButtonLabel: undefined | string

Accessibility close button label

Default Value

'Close'


autoHide

autoHide: undefined | boolean

If true automatically hides the toast after the delay.

Default Value

true


children

children: SlotContent<ToastContext>

Template for the toast content


className

className: undefined | string

CSS classes to be applied on the widget main container

Default Value

''


defaultSlots

readonly defaultSlots: WritableSignal<Partial<ToastProps>, Partial<ToastProps>>


delay

delay: undefined | number

Delay in milliseconds before hiding the toast.

Default Value

5000


dismissible

dismissible: undefined | boolean

If true, alert can be dismissed by the user. The close button (×) will be displayed and you can be notified of the event with the (close) output.

Default Value

true


header

header: SlotContent<ToastContext>

Header template for the toast component


hidden

hidden: EventEmitter<void>

Callback called when the alert is hidden.

Default Value
() => {}

shown

shown: EventEmitter<void>

Callback called when the alert is shown.

Default Value
() => {}

slotDefaultFromContent

slotDefaultFromContent: undefined | ToastBodyDirective


slotHeaderFromContent

slotHeaderFromContent: undefined | ToastHeaderDirective


slotStructureFromContent

slotStructureFromContent: undefined | ToastStructureDirective


structure

structure: SlotContent<ToastContext>

Global template for the toast component


transition

transition: undefined | TransitionFn

The transition function will be executed when the alert is displayed or hidden.

Depending on the value of animatedOnInit, the animation can be optionally skipped during the showing process.

Default Value

fadeTransition


visible

visible: undefined | boolean

If true the alert is visible to the user

Default Value

true


visibleChange

visibleChange: EventEmitter<boolean>

Callback called when the alert visibility changed.

Default Value
() => {}
Accessors
api

get api(): W["api"]

Returns

W["api"]


state

get state(): Signal<WidgetState<W>>

Returns

Signal<WidgetState<W>>


widget

get widget(): ContextWidget<W>

Returns

ContextWidget<W>

Methods
ngAfterContentChecked

ngAfterContentChecked(): void

A callback method that is invoked immediately after the default change detector has completed checking all of the directive's content.

Returns

void

Implementation of

AfterContentChecked.ngAfterContentChecked


ngOnChanges

ngOnChanges(changes): void

Parameters

changes: SimpleChanges

Returns

void

Inherit Doc

ngOnInit

ngOnInit(): void

Returns

void

Inherit Doc

ToastContext

type alias

ToastContext: WidgetSlotContext<ToastWidget>


ToastDefaultSlotsComponent

class
Constructors
new ToastDefaultSlotsComponent

new ToastDefaultSlotsComponent(): ToastDefaultSlotsComponent

Returns

ToastDefaultSlotsComponent

Properties
structure

structure: TemplateRef<ToastContext>


toastDefaultSlotStructure

constant

const toastDefaultSlotStructure: ComponentTemplate<unknown, "structure", ToastDefaultSlotsComponent>


ToastDirectives

interface
Properties
autoHideDirective

autoHideDirective: Directive

Directive that handles the autohide of the toast component


bodyDirective

bodyDirective: Directive

Directive that adds all the necessary attributes to the body


closeButtonDirective

closeButtonDirective: Directive

Directive that adds all the necessary attributes to the close button depending on the presence of the header


transitionDirective

transitionDirective: Directive

the transition directive, piloting what is the visual effect of going from hidden to visible


ToastHeaderDirective

class
Constructors
new ToastHeaderDirective

new ToastHeaderDirective(): ToastHeaderDirective

Returns

ToastHeaderDirective

Properties
templateRef

templateRef: TemplateRef<any>

Methods
ngTemplateContextGuard

static ngTemplateContextGuard(dir, context): context is ToastContext

Parameters

dir: ToastHeaderDirective

context: unknown

Returns

context is ToastContext


ToastProps

interface
Properties
animated

animated: boolean

If true, alert closing will be animated.

Animation is triggered when clicked on the close button (×), via the .close() function or the visible prop is changed

Default Value

true


animatedOnInit

animatedOnInit: boolean

If true, alert opening will be animated.

Animation is triggered when the .open() function is called or the visible prop is changed

Default Value

false


ariaCloseButtonLabel

ariaCloseButtonLabel: string

Accessibility close button label

Default Value

'Close'


autoHide

autoHide: boolean

If true automatically hides the toast after the delay.

Default Value

true


children

children: SlotContent<ToastContext>

Template for the toast content


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


delay

delay: number

Delay in milliseconds before hiding the toast.

Default Value

5000


dismissible

dismissible: boolean

If true, alert can be dismissed by the user. The close button (×) will be displayed and you can be notified of the event with the (close) output.

Default Value

true


header

header: SlotContent<ToastContext>

Header template for the toast component


onHidden

onHidden: () => void

Callback called when the alert is hidden.

Returns

void

Default Value
() => {}

onShown

onShown: () => void

Callback called when the alert is shown.

Returns

void

Default Value
() => {}

onVisibleChange

onVisibleChange: (visible) => void

Callback called when the alert visibility changed.

Parameters

visible: boolean

Returns

void

Default Value
() => {}

structure

structure: SlotContent<ToastContext>

Global template for the toast component


transition

transition: TransitionFn

The transition function will be executed when the alert is displayed or hidden.

Depending on the value of animatedOnInit, the animation can be optionally skipped during the showing process.

Default Value

fadeTransition


visible

visible: boolean

If true the alert is visible to the user

Default Value

true


ToastState

interface
Properties
ariaCloseButtonLabel

ariaCloseButtonLabel: string

Accessibility close button label

Default Value

'Close'


autoHide

autoHide: boolean

If true automatically hides the toast after the delay.

Default Value

true


children

children: SlotContent<ToastContext>

Template for the toast content


className

className: string

CSS classes to be applied on the widget main container

Default Value

''


delay

delay: number

Delay in milliseconds before hiding the toast.

Default Value

5000


dismissible

dismissible: boolean

If true, alert can be dismissed by the user. The close button (×) will be displayed and you can be notified of the event with the (close) output.

Default Value

true


header

header: SlotContent<ToastContext>

Header template for the toast component


hidden

hidden: boolean

Is true when the alert is hidden. Compared to visible, this is updated after the transition is executed.


structure

structure: SlotContent<ToastContext>

Global template for the toast component


visible

visible: boolean

If true the alert is visible to the user

Default Value

true


ToastStructureDirective

class
Constructors
new ToastStructureDirective

new ToastStructureDirective(): ToastStructureDirective

Returns

ToastStructureDirective

Properties
templateRef

templateRef: TemplateRef<any>

Methods
ngTemplateContextGuard

static ngTemplateContextGuard(dir, context): context is ToastContext

Parameters

dir: ToastStructureDirective

context: unknown

Returns

context is ToastContext


ToastWidget

type alias

ToastWidget: Widget<ToastProps, ToastState, ToastApi, object, ToastDirectives>