HxToast #
Bootstrap Toast component. Not intended to be used in user code, use HxMessenger
.
After the first render, the component never updates.
Basic usage #
HxToast
is usually not used directly, but as a part of HxMessenger
component.
See HxMessenger documentation.
Direct toast rendering #
You can use HxToast
directly to show a toast. Usually you will use it in combination with HxToastContainer
.
Invoice has been created.
Hi! All messages have been deleted and cannot be restored.
This message should disappear after 5 sec.
Always visible. No close button here.
HxToast
supports static server rendering.
API #
Parameters #
Name |
Type |
Description |
AutohideDelay |
int? |
Delay in milliseconds to automatically hide the toast. |
Color |
ThemeColor? |
Color scheme. |
ContentTemplate |
RenderFragment |
Content (body) template. |
ContentText |
string |
Content (body) text. |
CssClass |
string |
CSS class to render with the toast. |
HeaderIcon |
IconBase |
Header icon. |
HeaderTemplate |
RenderFragment |
Header template. |
HeaderText |
string |
Header text. |
ShowCloseButton |
bool |
Indicates whether to show the close button. |
Event callbacks #
Name |
Type |
Description |
OnToastHidden |
EventCallback |
Fires when the toast is hidden (button or autohide). |
CSS variables #
Name |
Description |
Default |
--hx-toast-container-margin |
Margin of the container.
|
0.5rem |
HxToastContainer #
API #
Parameters #
Name |
Type |
Description |
ChildContent |
RenderFragment |
Toasts to display. |
CssClass |
string |
Additional CSS class. |
Position |
ToastContainerPosition |
Positioning of the toasts on the screen. |