PleasantSnackbar

April 2, 2026 · View on GitHub

A temporary pill-shaped notification that appears at the bottom of the window. Supports severity variants, title, action buttons, close button, and Closing/Closed events.

Basic usage

PleasantSnackbar.Show(window, new PleasantSnackbarOptions("File saved successfully.")
{
    Icon             = MaterialIcons.CheckCircleOutline,
    NotificationType = NotificationType.Success
});

PleasantSnackbarOptions

PropertyTypeDefaultDescription
MessagestringrequiredBody text
Titlestring?nullBold title above the message — pill expands vertically
IconGeometry?nullIcon shown in the colored pill on the left
NotificationTypeInformation / Success / Warning / ErrorInformationControls the icon pill color
TimeSpanTimeSpan3 sHow long the snackbar stays visible
ButtonTextstring?nullText for an inline action button
ButtonActionAction?nullCallback when the action button is clicked
ActionButtonControl?nullArbitrary control in the action slot (overrides ButtonText/ButtonAction)
IsClosableboolfalseShows a × dismiss button
ClosingEventHandler<SnackbarClosingEventArgs>?nullFired before close — set Cancel = true to prevent it
ClosedEventHandler<SnackbarClosedEventArgs>?nullFired after close with the SnackbarCloseReason

Severity variants

// Information (default)
PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Update available."));

// Success
PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Saved.")
    { NotificationType = NotificationType.Success, Icon = MaterialIcons.CheckCircleOutline });

// Warning
PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Low disk space.")
    { NotificationType = NotificationType.Warning, Icon = MaterialIcons.AlertOutline });

// Error
PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Upload failed.")
    { NotificationType = NotificationType.Error, Icon = MaterialIcons.CloseCircleOutline });

With title (two-line pill)

PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Your changes have been saved to the cloud.")
{
    Title            = "Saved",
    Icon             = MaterialIcons.CloudCheckOutline,
    NotificationType = NotificationType.Success
});

With action button

PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Item moved to trash.")
{
    ButtonText   = "Undo",
    ButtonAction = () => RestoreItem()
});

With custom action control

var btn = new Button { Content = "View", Theme = accentTheme };
btn.Click += (_, _) => OpenDetails();

PleasantSnackbar.Show(window, new PleasantSnackbarOptions("New update available.")
{
    ActionButton = btn
});

Closable with events

PleasantSnackbar.Show(window, new PleasantSnackbarOptions("Background sync running.")
{
    IsClosable = true,
    TimeSpan   = TimeSpan.FromSeconds(10),
    Closing    = (_, args) =>
    {
        if (args.Reason == SnackbarCloseReason.CloseButton)
            CancelSync();
    },
    Closed = (_, args) => Console.WriteLine($"Closed: {args.Reason}")
});

Show overloads

PleasantSnackbar.Show(options);                    // uses active window
PleasantSnackbar.Show(window, options);            // Window
PleasantSnackbar.Show(pleasantWindow, options);    // IPleasantWindow
PleasantSnackbar.Show(topLevel, options);          // TopLevel