fun showToast(styling: BasicParams.() -> Unit = {}, baseClass: StyleClass = StyleClass.None, id: String? = null, prefix: String = ToastComponent.defaultToastContainerPrefix, build: ToastComponent.() -> Unit)

This factory method creates a toast and displays it right away. Use toast in order to display a toast delayed, e.g. when a button is pressed.

A toast usually consists of a content you prefer via the content { ... } property. Additional properties can be set as well:

showToast {
position { bottomRight }
content {

For a detailed overview about the possible properties of the component object itself and more use cases, have a look at ToastComponent.



optional CSS class that should be applied to the toast element


a lambda expression for setting up the component itself.


ID of the toast element


prefix for the generated CSS class of the toast element resulting in the form `$prefix-$hash`


lambda expression for declaring the styling of the toast using fritz2's styling DSL