ToastComponentBase

abstract class ToastComponentBase : ManagedComponent<Unit> , CloseButtonProperty

This class is the base for different types of toast-components and contains all necesserary logic except the content-related aspects. This way, different types of toasts with specific DSL variations can be implemented by inheriting from this base class and implementing the rendering logic exposed via the avstract renderContent method.

Currently, the following comppnents are part of the toast family:

See the respective subclass's documentation for more information and concrete usage examples.

Constructors

ToastComponentBase
Link copied to clipboard
js
fun ToastComponentBase()

Types

CloseMethodCompanion
Link copied to clipboard
js
open class CloseMethodCompanion
This class defines helpful methods to either close all currently open (closeAllToasts) or the last created toast (closeLastToast) which can be called via the companion objects of both ToastComponent and AlertToastComponent.
Companion
Link copied to clipboard
js
object Companion : ToastComponentBase.CloseMethodCompanion
Placement
Link copied to clipboard
js
object Placement
ToastFragment
Link copied to clipboard
js
data class ToastFragment(id: String, placement: String, render: RenderContext.() -> Li)
ToastStore
Link copied to clipboard
js
object ToastStore : RootStore<List<ToastComponentBase.ToastFragment>>

Functions

render
Link copied to clipboard
js
open override fun render(styling: BoxParams.() -> Unit, baseClass: StyleClass, id: String?, prefix: String)
This method registers one toast at the central toast store and creates a rendering expression that will be executed by the central rendering in the companion's object ToastComponentBase.Companion init block.

Properties

background
Link copied to clipboard
js
val background: ComponentProperty<Colors.() -> ColorProperty>
closeButtonIcon
Link copied to clipboard
js
open override val closeButtonIcon: ComponentProperty<Icons.() -> IconDefinition>
closeButtonPrefix
Link copied to clipboard
js
open override val closeButtonPrefix: String
closeButtonRendering
Link copied to clipboard
js
open override val closeButtonRendering: ComponentProperty<RenderContext.() -> DomListener<MouseEvent, HTMLElement>>
closeButtonStyle
Link copied to clipboard
js
open override val closeButtonStyle: ComponentProperty<Style<BasicParams>>
duration
Link copied to clipboard
js
val duration: ComponentProperty<Long>
hasCloseButton
Link copied to clipboard
js
open override val hasCloseButton: ComponentProperty<Boolean>
placement
Link copied to clipboard
js
val placement: ComponentProperty<ToastComponentBase.Placement.() -> String>

Inheritors

ToastComponent
Link copied to clipboard
AlertToastComponent
Link copied to clipboard