Table of Contents

Class ToastModel

Namespace
TwBlazor.Models
Assembly
TwBlazor.dll

Represents a toast notification message.

public class ToastModel
Inheritance
ToastModel
Inherited Members

Constructors

ToastModel()

public ToastModel()

Properties

Color

Gets or sets the color theme of the toast.

public Color? Color { get; set; }

Property Value

Color?

CreatedAt

Gets or sets the timestamp when the toast was created.

public DateTime CreatedAt { get; set; }

Property Value

DateTime

Duration

Gets or sets the duration in milliseconds before the toast auto-dismisses.

public int Duration { get; set; }

Property Value

int

Remarks

Set to 0 to disable auto-dismiss. Default is 5000ms (5 seconds).

ElapsedTimeText

Gets the elapsed time text for display.

public string ElapsedTimeText { get; }

Property Value

string

Icon

Gets or sets the icon to display in the toast.

public Icon? Icon { get; set; }

Property Value

Icon?

Id

Gets or sets the unique identifier for the toast.

public Guid Id { get; set; }

Property Value

Guid

IsBurnt

Gets whether the toast has exceeded its display duration.

public bool IsBurnt { get; }

Property Value

bool

Remarks

Always false while IsPaused, and time spent paused is excluded from the elapsed duration once resumed, so hovering/focusing a toast never counts against its lifetime.

IsFocused

Gets whether this toast (or a descendant, e.g. its close button) currently has keyboard focus.

public bool IsFocused { get; }

Property Value

bool

IsHovered

Gets whether the pointer is currently hovering this toast.

public bool IsHovered { get; }

Property Value

bool

IsPaused

Gets whether the toast's auto-dismiss timer is currently paused, i.e. because the pointer is hovering it, it has keyboard focus, or both.

public bool IsPaused { get; }

Property Value

bool

Remarks

Hover and focus are tracked independently so that, e.g., moving the pointer away from a toast that still has keyboard focus (or vice versa) doesn't prematurely resume the auto-dismiss timer while the toast is still being interacted with.

Message

Gets or sets the message content of the toast.

public string Message { get; set; }

Property Value

string

Title

Gets or sets the title of the toast.

public string Title { get; set; }

Property Value

string

Methods

PauseForFocus()

Marks the toast as having keyboard focus, pausing its auto-dismiss timer.

public void PauseForFocus()

PauseForHover()

Marks the toast as hovered by the pointer, pausing its auto-dismiss timer.

public void PauseForHover()

ResumeForFocus()

Marks the toast as no longer having keyboard focus, resuming its auto-dismiss timer only if the pointer also isn't currently hovering it.

public void ResumeForFocus()

ResumeForHover()

Marks the toast as no longer hovered by the pointer, resuming its auto-dismiss timer only if it also doesn't currently have keyboard focus.

public void ResumeForHover()