Example of Notification in ASP.NET MVC Badge Control
This sample demonstrates the type of the notification badge. To apply the notification badge, add .e-badge-notification class or .e-badge-dot class for dot badge along with the .e-badge class.
Notification
99+
7
99+
18
Circle
19
27
3
85
Dot
@Html.UiBadge(new UiBadgeOptions { Content = "99+", Color = UiBadgeColor.Warning, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "7", Color = UiBadgeColor.Primary, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "99+", Color = UiBadgeColor.Danger, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "18", Color = UiBadgeColor.Secondary, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "19", Color = UiBadgeColor.Warning, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
@Html.UiBadge(new UiBadgeOptions { Content = "27", Color = UiBadgeColor.Primary, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
@Html.UiBadge(new UiBadgeOptions { Content = "3", Color = UiBadgeColor.Danger, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
@Html.UiBadge(new UiBadgeOptions { Content = "85", Color = UiBadgeColor.Secondary, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Success, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, Bottom = true, AriaLabel = "Status" })
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Success, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, Bottom = true, AriaLabel = "Status" })
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Info, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, AriaLabel = "Status" })
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Danger, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, AriaLabel = "Status" })
<style>
.sample_container { max-width: 900px; margin: 0 auto; padding: 24px 0; }
.badge-block { display: inline-block; position: relative; margin: 14px 18px; vertical-align: middle; }
.badge-showcase { display: inline-block; width: 180px; margin: 10px; padding: 16px 8px; border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-surface); text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.badge-showcase .text { margin-top: 12px; font-size: 12px; }
.badge-showcase button { position: relative; }
.margin { margin: 12px 0 4px; }
.fontSize { font-weight: 600; font-size: 15px; }
.svg_icons { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; color: #fff; font-weight: 700; font-size: 16px; }
.whatsapp { background: #25d366; } .twitter { background: #1da1f2; } .facebook { background: #1877f2; } .skype { background: #00aff0; } .pinterest { background: #e60023; } .contact { background: #6b7280; }
</style>
<div class="control-section">
<div class="sample_container badge-notification">
<div class="layout">
<div class="margin fontSize">Notification</div>
<div class="badge-block">
<div class="whatsapp svg_icons" aria-hidden="true">W</div>
@Html.UiBadge(new UiBadgeOptions { Content = "99+", Color = UiBadgeColor.Warning, Position = UiBadgePosition.Notification })
</div>
<div class="badge-block">
<div class="twitter svg_icons" aria-hidden="true">T</div>
@Html.UiBadge(new UiBadgeOptions { Content = "7", Color = UiBadgeColor.Primary, Position = UiBadgePosition.Notification })
</div>
<div class="badge-block">
<div class="facebook svg_icons" aria-hidden="true">F</div>
@Html.UiBadge(new UiBadgeOptions { Content = "99+", Color = UiBadgeColor.Danger, Position = UiBadgePosition.Notification })
</div>
<div class="badge-block">
<div class="skype svg_icons" aria-hidden="true">S</div>
@Html.UiBadge(new UiBadgeOptions { Content = "18", Color = UiBadgeColor.Secondary, Position = UiBadgePosition.Notification })
</div>
<div class="margin fontSize">Circle</div>
<div class="badge-block">
<div class="whatsapp svg_icons" aria-hidden="true">W</div>
@Html.UiBadge(new UiBadgeOptions { Content = "19", Color = UiBadgeColor.Warning, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
</div>
<div class="badge-block">
<div class="twitter svg_icons" aria-hidden="true">T</div>
@Html.UiBadge(new UiBadgeOptions { Content = "27", Color = UiBadgeColor.Primary, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
</div>
<div class="badge-block">
<div class="facebook svg_icons" aria-hidden="true">F</div>
@Html.UiBadge(new UiBadgeOptions { Content = "3", Color = UiBadgeColor.Danger, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
</div>
<div class="badge-block">
<div class="skype svg_icons" aria-hidden="true">S</div>
@Html.UiBadge(new UiBadgeOptions { Content = "85", Color = UiBadgeColor.Secondary, Position = UiBadgePosition.Notification, Shape = UiBadgeShape.Circle })
</div>
<div class="margin fontSize">Dot</div>
<div class="badge-block">
<div class="contact svg_icons" aria-hidden="true">C</div>
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Success, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, Bottom = true, AriaLabel = "Status" })
</div>
<div class="badge-block">
<div class="skype svg_icons" aria-hidden="true">S</div>
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Success, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, Bottom = true, AriaLabel = "Status" })
</div>
<div class="badge-block">
<div class="facebook svg_icons" aria-hidden="true">F</div>
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Info, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, AriaLabel = "Status" })
</div>
<div class="badge-block">
<div class="pinterest svg_icons" aria-hidden="true">P</div>
@Html.UiBadge(new UiBadgeOptions { Color = UiBadgeColor.Danger, Shape = UiBadgeShape.Dot, Position = UiBadgePosition.Overlap, AriaLabel = "Status" })
</div>
</div>
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class BadgeController : Controller
{
// The page is Views/Badge/Notification.cshtml; it draws what ViewData holds.
public ActionResult Notification()
{
return View();
}
}
}
@* Install once: Install-Package Lumen.UI.Mvc (or: dotnet add package Lumen.UI.Mvc) *@
@* Views/Web.config: <add namespace="Lumen.UI.Mvc" /> *@
@* Views/Shared/_Layout.cshtml *@
<head>
@Html.UiStyles()
<link rel="stylesheet" href="~/Content/site.css" />
</head>
<body>
@RenderBody()
@Html.UiScripts()
@RenderSection("scripts", required: false)
</body>
There are 3 type of Notification badge, they are listed below. When using notification badge always apply position: relative to the container element.
- Default notification -
.e-badge-notificationapplies general notification badge. - Circle notification -
.e-badge-circlealong with.e-badge-notificationto apply circle notification badge. - Dot notification -
.e-badge-dotapplied the dot badge to the target element.
The position can be changed to the bottom by adding the .e-badge-bottom class.