Overview
Toasts display low priority, event-driven feedback which usually doesn’t require any user interaction. They appear for a set time and disappear automatically.
The Toast informs users of a process that an app has performed or will perform. It appears temporarily, towards the bottom of the screen.
Usage
Default Toast
string text = "This is a Toast";
string actionButtonText = "Dismiss";
Action action = async () => await DisplayAlert("Toast action Tapped", "The user has tapped the toast action button", "OK");
var toast = new TMToast(text, actionButtonText, action);
toast.Show();
When creating the TMToast, its parameter string message is required. All other parameters are optional.
Update Theme
Toast supports six different styles. All available styles can be found here in the modus docs.
This is how you can update the style of the toast
var toast = new TMToast("Data saved successfully") {
theme = ToastTheme.Success
};
toast.Show();
Properties
Property | type | Description |
---|---|---|
message | string | Text message (constructor parameter) - Required |
actionButtonText | string | Action button text (will be displayed instead of the X button if provided). |
action | Action | Action to invoke on action button click. |
theme | ToastTheme | Used to update the coloring of the toast |