Toast content
Adaptive and interactive toast notifications let you create flexible notifications with text, images, and buttons/inputs.
Important APIs: UWP Community Toolkit Notifications nuget package
Getting started
You can define a notification's content using XML or the Microsoft.Toolkit.Uwp.Notifications builder syntax. To use XML, follow the XML sample tabs below and reference the toast notification XML schema. To use the Microsoft.Toolkit.Uwp.Notification C# builder syntax, install the NuGet package Microsoft.Toolkit.Uwp.Notifications, follow the Builder syntax sample tabs below and reference the toast content schema. The C# samples provided in this article use version 7.0.0 of the NuGet package.
Install Notifications Visualizer. This free Windows app helps you design interactive toast notifications by providing an instant visual preview of your toast as you edit it, similar to Visual Studio's XAML editor/design view. See Notifications Visualizer for more information, or download Notifications Visualizer from the Store.
Sending a toast notification
To learn how to send a notification, see Send local toast. This documentation only covers creating the toast content.
Toast notification structure
Toast notifications are a combination of some data properties like Tag/Group (which let you identify the notification) and the toast content.
The core components of toast content are...
- launch: This defines what arguments will be passed back to your app when the user clicks your toast, allowing you to deep link into the correct content that the toast was displaying. To learn more, see Send local toast.
- visual: The visual portion of the toast, including the generic binding that contains text and images.
- actions: The interactive portion of the toast, including inputs and actions.
- audio: Controls the audio played when the toast is shown to the user.
The toast content is defined in raw XML, but you can use our NuGet library to get a C# (or C++) object model for constructing the toast content. This article documents everything that goes within the toast content.
new ToastContentBuilder()
.AddArgument("conversationId", 9813)
.AddText("Some text")
.AddButton(new ToastButton()
.SetContent("Archive")
.AddArgument("action", "archive")
.SetBackgroundActivation())
.AddAudio(new Uri("ms-appx:///Sound.mp3"));
Here is a visual representation of the toast's content:

Attribution area
The attribution area is at the top of the toast notification. Starting with Windows 11, your app's name and icon are displayed in this area. The attribution area also includes a close button that allows the user to quickly dismiss the notification and an ellipses menu that allows the user to quickly disable notifications for your app or go to the Windows Settings page for your app's notifications. The attribution area is configured by the shell and can't be overridden in the toast XML payload, although your app can add items to the attribution area context menu. For more information see Context menu actions.
Visual
Each toast must specify a visual, where you must provide a generic toast binding, which can contain text, images, and more. These elements will be rendered on various Windows devices, including desktop, phones, tablets, and Xbox.
For all attributes supported in the visual section and its child elements, see the schema documentation.
Text elements
Each toast must have at least one text element, and can contain two additional text elements, all of type AdaptiveText.

Since the Windows 10 Anniversary Update, you can control how many lines of text are displayed by using the HintMaxLines property on the text. The default (and maximum) is up to 2 lines of text for the title, and up to 4 lines (combined) for the two additional description elements (the second and third AdaptiveText).
new ToastContentBuilder()
.AddText("Adaptive Tiles Meeting", hintMaxLines: 1)
.AddText("Conf Room 2001 / Building 135")
.AddText("10:00 AM - 10:30 AM");
Inline image
By default, images are displayed inline, after any text elements, filling the full width of the visual area.

new ToastContentBuilder()
...
.AddInlineImage(new Uri("https://picsum.photos/360/202?image=1043"));
App logo override
Specifying a placement value of appLogoOverride will cause the image to be displayed in a square on the left side of the visual area. The name of this property reflects the behavior in previous versions of Windows, where the image would replace the default app logo image. In Windows 11, the app logo is displayed in the attribution area, so it is not overridden by the appLogoOverride image placement.
Image dimensions are 48x48 pixels at 100% scaling. We generally recommend providing a version each icon asset for each scale factor: 100%, 125%, 150%, 200%, and 400%.

new ToastContentBuilder()
...
.AddAppLogoOverride(new Uri("https://picsum.photos/360/202?image=1043"), NotificationAppLogoCrop.Circle);
Hint crop
Microsoft style guidelines recommend representing profile pictures with a circular image to provide a consistent representation of people across apps and the shell. Set the HintCrop property to Circle to render the image with a circular crop.

new ToastContentBuilder()
...
.AddAppLogoOverride(new Uri("https://picsum.photos/48?image=883"), NotificationAppLogoCrop.Circle);
Hero image
New in Anniversary Update: Toasts can display a hero image, which is a featured ToastGenericHeroImage displayed prominently within the toast banner and while inside Notification Center. Image dimensions are 364x180 pixels at 100% scaling.

new ToastContentBuilder()
...
.AddHeroImage(new Uri("https://picsum.photos/364/180?image=1043"));
Image size restrictions
The images you use in your toast notification can be sourced from...
- http://
- ms-appx:///
- ms-appdata:///
For http and https remote web images, there are limits on the file size of each individual image. In the Fall Creators Update (16299), we increased the limit to be 3 MB on normal connections and 1 MB on metered connections. Before that, images were always limited to 200 KB.
| Normal connection | Metered connection | Before Fall Creators Update |
|---|---|---|
| 3 MB | 1 MB | 200 KB |
If an image exceeds the file size, or fails to download, or times out, the image will be dropped and the rest of the notification will be displayed.
Attribution text
New in Anniversary Update: If you need to reference the source of your content, you can use attribution text. This text is always displayed below any text elements, but above inline images. The text uses a slightly smaller size than standard text elements to help to distinguish from regular text elements.
On older versions of Windows that don't support attribution text, the text will simply be displayed as another text element (assuming you don't already have the maximum of three text elements).

new ToastContentBuilder()
...
.AddAttributionText("Via SMS");
Custom timestamp
New in Creators Update: You can now override the system-provided timestamp with your own timestamp that accurately represents when the message/information/content was generated. This timestamp is visible within Notification Center.

To learn more about using a custom timestamp, please see custom timestamps on toasts.
new ToastContentBuilder()
...
.AddCustomTimeStamp(new DateTime(2017, 04, 15, 19, 45, 00, DateTimeKind.Utc));
Progress bar
New in Creators Update: You can provide a progress bar on your toast notification to keep the user informed of the progress of operations such as downloads.

To learn more about using a progress bar, please see Toast progress bar.
Headers
New in Creators Update: You can group notifications under headers within Notification Center. For example, you can group messages from a group chat under a header, or group notifications of a common theme under a header, or more.

To learn more about using headers, please see Toast headers.
Adaptive content
New in Anniversary Update: In addition to the content specified above, you can also display additional adaptive content that is visible when the toast is expanded.
This additional content is specified using Adaptive, which you can learn more about by reading the Adaptive Tiles documentation.
Note that any adaptive content must be contained within an AdaptiveGroup. Otherwise it will not be rendered using adaptive.
Columns and text elements
Here's an example where columns and some advanced adaptive text elements are used. Since the text elements are within an AdaptiveGroup, they support all the rich adaptive styling properties.

new ToastContentBuilder()
...
.AddVisualChild(new AdaptiveGroup()
{
Children =
{
new AdaptiveSubgroup()
{
Children =
{
new AdaptiveText()
{
Text = "52 attendees",
HintStyle = AdaptiveTextStyle.Base
},
new AdaptiveText()
{
Text = "23 minute drive",
HintStyle = AdaptiveTextStyle.CaptionSubtle
}
}
},
new AdaptiveSubgroup()
{
Children =
{
new AdaptiveText()
{
Text = "1 Microsoft Way",
HintStyle = AdaptiveTextStyle.CaptionSubtle,
HintAlign = AdaptiveTextAlign.Right
},
new AdaptiveText()
{
Text = "Bellevue, WA 98008",
HintStyle = AdaptiveTextStyle.CaptionSubtle,
HintAlign = AdaptiveTextAlign.Right
}
}
}
}
});
Buttons
Buttons make your toast interactive, letting the user take quick actions on your toast notification without interrupting their current workflow. For example, users can reply to a message directly from within a toast, or delete an email without even opening the email app. Buttons appear in the expanded portion of your notification.
To learn more about implementing buttons end-to-end, see Send local toast.
Buttons can perform the following different actions...
- Activating the app in the foreground, with an argument that can be used to navigate to a specific page/context.
- Activating the app's background task, for a quick-reply or similar scenario.
- Activating another app via protocol launch.
- Performing a system action, such as snoozing or dismissing the notification.
Note
You can only have up to 5 buttons (including context menu items which we discuss later).

new ToastContentBuilder()
...
.AddButton(new ToastButton()
.SetContent("See more details")
.AddArgument("action", "viewDetails"))
.AddButton(new ToastButton()
.SetContent("Remind me later")
.AddArgument("action", "remindLater")
.SetBackgroundActivation());
Buttons with icons
You can add icons to your buttons. These icons are white transparent 16x16 pixel images at 100% scaling, and should have no padding included in the image itself. If you choose to provide icons on a toast notification, you must provide icons for ALL of your buttons in the notification, as it transforms the style of your buttons into icon buttons.
Note
For accessibility, be sure to include a contrast-white version of the icon (a black icon for white backgrounds), so that when the user turns on High Contrast White mode, your icon is visible. Learn more on the toast accessiblity page.
![]()
new ToastContentBuilder()
...
.AddButton(new ToastButton()
.SetContent("Dismiss")
.AddArgument("action", "dismiss")
.SetImageUri(new Uri("Assets/NotificationButtonIcons/Dismiss.png", UriKind.Relative))
.SetBackgroundActivation());
New in Windows 11 Update: You can add tooltips to your icons with the HintToolTip property in XML. This is ideal if your buttons have icons but no content, as this will make sure you can pass text that Windows Narrator can read. However, if content is present, then Narrator will read the content, no matter what is passed in the tooltip.
// The builder syntax does not support icon tooltips yet.
Buttons with colors
New in Windows 11 Update: You can add red or green colors to your buttons by adding the useButtonStyle attribute to the toast XML element and the hint-buttonStyle attribute to the action XML element as seen below.

// The builder syntax does not support red and green button colors yet.
Buttons with pending update activation
New in Fall Creators Update: On background activation buttons, you can use an after activation behavior of PendingUpdate to create multi-step interactions in your toast notifications. When the user clicks your button, your background task is activated, and the toast gets placed in a "pending update" state, where it stays on screen till your background task replaces the toast with a new toast.
To learn how to implement this, see Toast pending update.

Context menu actions
New in Anniversary Update: You can add additional context menu actions to the existing context menu that appears when the user right clicks your toast notification or selects the context menu icon.
Note
On older devices, these additional context menu actions will simply appear as normal buttons on your toast.
The additional context menu actions you add (such as "Mute group chat for 1 hour") appear above the two default system entries.

The builder syntax doesn't support context menu actions, so we recommend using initializer syntax.
ToastContent content = new ToastContent()
{
...
Actions = new ToastActionsCustom()
{
ContextMenuItems =
{
new ToastContextMenuItem("Mute group chat for 1 hour", "action=muteId")
}
}
};
Note
Additional context menu items contribute to the total limit of 5 buttons on a toast.
Activation of additional context menu items is handled identical to toast buttons.
Inputs
Inputs are specified within the Actions region of the toast region of the toast, meaning they are only visible when the toast is expanded.
Quick reply text box
To enable a quick reply text box (for example, in a messaging app) add a text input and a button, and reference the ID of the text input field so that the button is displayed next to to the input field. The optional icon for the button, if provided, should be a 32x32 pixel image with no padding, white pixels set to transparent, and 100% scale.

new ToastContentBuilder()
...
.AddInputTextBox("tbReply", "Type a reply")
.AddButton(new ToastButton()
.SetContent("Reply")
.SetTextBoxId("tbReply") // To place button next to text box, reference text box's id
.SetImageUri(new Uri("Assets/Reply.png", UriKind.Relative))
.AddArgument("action", "reply")
.SetBackgroundActivation());
Inputs with buttons bar
You also can have one (or many) inputs with normal buttons displayed below the inputs.

new ToastContentBuilder()
...
.AddInputTextBox("tbReply", "Type a reply")
.AddButton(new ToastButton()
.SetContent("Reply")
.AddArgument("action", "reply")
.SetBackgroundActivation())
.AddButton(new ToastButton()
.SetContent("Video call")
.AddArgument("action", "videoCall"));
Selection input
In addition to text boxes, you can also use a selection menu.

new ToastContentBuilder()
...
.AddToastInput(new ToastSelectionBox("time")
{
DefaultSelectionBoxItemId = "lunch",
Items =
{
new ToastSelectionBoxItem("breakfast", "Breakfast"),
new ToastSelectionBoxItem("lunch", "Lunch"),
new ToastSelectionBoxItem("dinner", "Dinner")
}
})
.AddButton(...)
.AddButton(...);
Snooze/dismiss
Using a selection menu and two buttons, we can create a reminder notification that utilizes the system snooze and dismiss actions. Make sure to set the scenario to Reminder for the notification to behave like a reminder.

We link the Snooze button to the selection menu input using the SelectionBoxId property on the toast button.
new ToastContentBuilder()
.SetToastScenario(ToastScenario.Reminder)
...
.AddToastInput(new ToastSelectionBox("snoozeTime")
{
DefaultSelectionBoxItemId = "15",
Items =
{
new ToastSelectionBoxItem("5", "5 minutes"),
new ToastSelectionBoxItem("15", "15 minutes"),
new ToastSelectionBoxItem("60", "1 hour"),
new ToastSelectionBoxItem("240", "4 hours"),
new ToastSelectionBoxItem("1440", "1 day")
}
})
.AddButton(new ToastButtonSnooze() { SelectionBoxId = "snoozeTime" })
.AddButton(new ToastButtonDismiss());
To use the system snooze and dismiss actions:
- Specify a ToastButtonSnooze or ToastButtonDismiss
- Optionally specify a custom content string:
- If you don't provide a string, we'll automatically use localized strings for "Snooze" and "Dismiss".
- Optionally specify the SelectionBoxId:
- If you don't want the user to select a snooze interval and instead just want your notification to snooze only once for a system-defined time interval (that is consistent across the OS), then don't construct any <input> at all.
- If you want to provide snooze interval selections:
- Specify SelectionBoxId in the snooze action
- Match the id of the input with the SelectionBoxId of the snooze action
- Specify ToastSelectionBoxItem's value to be a nonNegativeInteger which represents snooze interval in minutes.
Audio
Custom audio has always been supported by Mobile, and is supported in Desktop Version 1511 (build 10586) or later. Custom audio can be referenced via the following paths:
- ms-appx:///
- ms-appdata:///
Alternatively, you can pick from the list of ms-winsoundevents, which have always been supported on both platforms.
new ToastContentBuilder()
...
.AddAudio(new Uri("ms-appx:///Assets/NewMessage.mp3"));
See the audio schema page for information on audio in toast notifications. To learn how to send a toast using custom audio, see custom audio on toasts.
Scenarios
To create important notifications, alarms, reminders, and incoming call notifications, you simply use a normal toast notification with a Scenario value assigned to it. The scenario adjusts a few behaviors to create a consistent and unified user experience. There are four possible Scenario values:
- Reminder
- Alarm
- IncomingCall
- Urgent
Reminders
In the reminder scenario, the notification will stay on screen until the user dismisses it or takes action. On Windows Mobile, the toast will also show pre-expanded. A reminder sound will be played. You must provide at least one button on your toast notification. Otherwise, the toast will be treated as a normal toast.
new ToastContentBuilder()
.SetToastScenario(ToastScenario.Reminder)
...
Alarms
Alarms behave the same as reminders, except alarms will additionally loop audio with a default alarm sound. You must provide at least one button on your toast notification. Otherwise, the toast will be treated as a normal toast.
new ToastContentBuilder()
.SetToastScenario(ToastScenario.Alarm)
...
Incoming calls
Incoming call notifications are displayed pre-expanded in a special call format and stay on the user's screen till dismissed. Ringtone audio will loop by default. On Windows Mobile devices, they display full screen.

new ToastContentBuilder()
.SetToastScenario(ToastScenario.IncomingCall)
...
Important Notifications
Important
Requires: You must be running Windows Insider Preview Build 22546 or later to use important notifications.
Important notifications allow users to have more control over what 1st party and 3rd party apps can send them high-priority toast notifications (urgent/important) that can break through Focus Assist (Do not Disturb). This can be modified in the notifications settings.

// The builder syntax does not support important notifications yet.
Localization and accessibility
Your tiles and toasts can load strings and images tailored for display language, display scale factor, high contrast, and other runtime contexts. For more info, see Tile and toast notification support for language, scale, and high contrast.
Handling activation
To learn how to handle toast activations (the user clicking your toast or buttons on the toast), see Send local toast.
Related topics
Feedback
Submit and view feedback for