Skip to content

ToastType doesn't apply classes to regular Toast, only the SimpleToast #1215

@mDeaders

Description

@mDeaders

Describe the bug
It appears the regular Toast (with title and helptext) does not apply the color classes to the toast.
The SimpleToast however does pop up perfectly with a red background when set to danger.

To Reproduce
Steps to reproduce the behavior:

  1. Setup a ToastComponent
  2. Trigger a ToastService.Notify(new(ToastType.Danger, "SimpleToast Danger Color" ))
  3. Trigger a ToastService.Notify(new(ToastType.Danger, "", "Toast", "HelpText", "regular 'Toast' Danger Color", false ))
  4. Notice the color is not applied to the second toast.

Expected behavior
Both toast types to be styled to match the ToastType.

Screenshots
Image

Versions (please complete the following information):

  • .NET Version: .NET 10
  • BlazorBootstrap: 3.5.0
  • Blazor WebAssembly / Server: Server
  • Blazor Interactive Render Mode: interactiveserver for Toast component
  • Blazor Interactivity Location: page/component

Sample code

InvokeAsync(() => ToastService.Notify(new(ToastType.Success, "", "Toast", "HelpText", "Can't read this", false )));

Additional context

Little deeper dive reveals that in the simple toast we find this for the class assignment which looks correct:
On line 20:

protected override string? ClassNames => BlazorBootstrapComponentBase.BuildClassNames(base.Class, ("toast", true), (ToastMessage.Type.ToToastTextColorClass(), ToastMessage != null), (ToastMessage.Type.ToToastBackgroundColorClass(), ToastMessage != null));

but in the regular toast we find this:
On line 28:

protected override string? ClassNames => BlazorBootstrapComponentBase.BuildClassNames(base.Class, ("toast", true));

Perhaps I'm misunderstanding something, but I suspect it might be a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions