toast

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

This factory method creates a toast that will be shown when the returned handler is triggered, eg. on a button press.

You can bind this toast to a Flow where every element of this Flow will then create a toast or you may combine the toast directly with some other component that has a listener which fits to our handler, like for example a clickButton.

Usage example:

clickButton {
variant { outline }
text("ADD TOAST")
} handledBy toast {
position { topLeft }
duration(5000L)
...
content {
...
}
}

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

Parameters

baseClass

optional CSS class that should be applied to the toast element

build

a lambda expression for setting up the component itself

id

ID of the toast element

prefix

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

styling

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