Skip to content

MudSnackbar: Add global HideIcon option#11900

Merged
ScarletKuro merged 2 commits intoMudBlazor:devfrom
franco-diaz-licham:feature/snackbar-hide-icon
Sep 22, 2025
Merged

MudSnackbar: Add global HideIcon option#11900
ScarletKuro merged 2 commits intoMudBlazor:devfrom
franco-diaz-licham:feature/snackbar-hide-icon

Conversation

@franco-diaz-licham
Copy link
Contributor

@franco-diaz-licham franco-diaz-licham commented Sep 22, 2025

Summary

Fixes: #11677

  • Added HideIcon property to CommonSnackbarOptions so it is available in both:
    • SnackbarConfiguration (global config via Program.cs)
    • SnackbarOptions (per-snackbar override).
  • Removed duplicate HideIcon property from SnackbarOptions since it now inherits from CommonSnackbarOptions.
  • Updated AddMudServices to pass through the new option.
  • Added unit tests covering:
    • Global default (HideIcon = false)
    • Global HideIcon = true
    • Per-snackbar override of global setting.

Usage

Global configuration in Program.cs:

builder.Services.AddMudServices(cfg =>
{
    cfg.SnackbarConfiguration.HideIcon = true;
});

Per-snackbar override:

_snackbar.Add("Saved!", Severity.Success, o => o.HideIcon = false);

@mudbot mudbot bot added the enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library label Sep 22, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively adds a global HideIcon option for Snackbars, which is a useful enhancement. The implementation is clean, moving the property to CommonSnackbarOptions to avoid duplication and making it available for both global and per-snackbar configuration. The new functionality is well-covered by unit tests, which is great to see. I've only found one minor issue with a misleading comment and a slightly confusing name in one of the new tests, which I've flagged for correction. Overall, this is a solid contribution.

@danielchalmers danielchalmers changed the title Snackbar: add global HideIcon option (Closes #11677) MudSnackbar: Add global HideIcon option Sep 22, 2025
Copy link
Contributor

@versile2 versile2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, thank you!

@ScarletKuro ScarletKuro merged commit 9387d3d into MudBlazor:dev Sep 22, 2025
4 checks passed
@franco-diaz-licham
Copy link
Contributor Author

Thank you guys, pleasure to have made my first contribution to Mudblazor!
Really love the framework and will look to be more involved in this project.
Regards,
Franco.

@franco-diaz-licham franco-diaz-licham deleted the feature/snackbar-hide-icon branch September 26, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SnackBar Should Have HideIcon In Services Configuration

3 participants