Skip to content

Commit

Permalink
add showicon, iconstyle and iconsize.
Browse files Browse the repository at this point in the history
  • Loading branch information
tesar-tech committed Jan 12, 2025
1 parent 9f39acf commit a8cb836
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
15 changes: 15 additions & 0 deletions Source/Blazorise/Components/Toast/ToastInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ public ToastInstance( ToastProvider toastProvider, string toastId, string title,
/// </summary>
public string Style => ToastInstanceOptions?.Style;

/// <summary>
/// Determines whether to show an icon in the Toast. Defaults to true.
/// </summary>
public bool? ShowIcon => ToastInstanceOptions?.ShowIcon;

/// <summary>
/// Custom inline styles to apply to the icon in the Toast.
/// </summary>
public IconStyle? IconStyle => ToastInstanceOptions?.IconStyle;

/// <summary>
/// The size of the icon in the Toast.
/// </summary>
public IconSize? IconSize => ToastInstanceOptions?.IconSize;

/// <summary>
/// Icon to display inside the ToastHeader.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Source/Blazorise/Components/ToastProvider/ToastProvider.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
Style="@toastInstance.Style"
Class="@toastInstance.Class">
<ToastHeader>
@if ( ShowIntentIcon )
@if ( toastInstance.ShowIcon ?? ShowIntentIcon )
{
<Icon Name="@(GetIconName( toastInstance ))" TextColor="@GetIconColor( toastInstance.Intent )" Margin="Blazorise.Margin.Is2.FromEnd" />
<Icon Name="@(GetIconName( toastInstance ))" IconStyle="toastInstance.IconStyle" IconSize="toastInstance.IconSize" TextColor="@GetIconColor( toastInstance.Intent )" Margin="Blazorise.Margin.Is2.FromEnd" />
}
<Strong>@toastInstance.Title</Strong>
@if ( ShowCloseButton )
Expand Down
15 changes: 15 additions & 0 deletions Source/Blazorise/Models/ToastInstanceOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ public class ToastInstanceOptions
/// Icon to display inside the ToastHeader.
/// </summary>
public IconName? IconName { get; set; }

/// <summary>
/// Determines whether to show an icon in the Toast.
/// </summary>
public bool? ShowIcon { get; set; }

/// <summary>
/// Style to apply to the icon in the Toast.
/// </summary>
public IconStyle? IconStyle { get; set; }

/// <summary>
/// The size of the icon in the Toast.
/// </summary>
public IconSize? IconSize { get; set; }

/// <summary>
/// Creates the default toast options.
Expand Down

0 comments on commit a8cb836

Please sign in to comment.