.ui-badge-primaryExample of Types in ASP.NET MVC Badge Control
This sample demonstrates the 8-predefined badge colors for various scenarios which can be applied from modifier class.
10
20
.ui-badge-secondary
25
.ui-badge-success
30
.ui-badge-danger
35
.ui-badge-warning
40
.ui-badge-info
45
.ui-badge-light
50
.ui-badge-dark
@Html.UiBadge(new UiBadgeOptions { Content = "10", Color = UiBadgeColor.Primary, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "20", Color = UiBadgeColor.Secondary, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "25", Color = UiBadgeColor.Success, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "30", Color = UiBadgeColor.Danger, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "35", Color = UiBadgeColor.Warning, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "40", Color = UiBadgeColor.Info, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "45", Color = UiBadgeColor.Light, Position = UiBadgePosition.Notification })
@Html.UiBadge(new UiBadgeOptions { Content = "50", Color = UiBadgeColor.Dark, Position = UiBadgePosition.Notification })
<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-types">
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Primary</button> @Html.UiBadge(new UiBadgeOptions { Content = "10", Color = UiBadgeColor.Primary, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-primary</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Secondary</button> @Html.UiBadge(new UiBadgeOptions { Content = "20", Color = UiBadgeColor.Secondary, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-secondary</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Success</button> @Html.UiBadge(new UiBadgeOptions { Content = "25", Color = UiBadgeColor.Success, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-success</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Danger</button> @Html.UiBadge(new UiBadgeOptions { Content = "30", Color = UiBadgeColor.Danger, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-danger</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Warning</button> @Html.UiBadge(new UiBadgeOptions { Content = "35", Color = UiBadgeColor.Warning, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-warning</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Info</button> @Html.UiBadge(new UiBadgeOptions { Content = "40", Color = UiBadgeColor.Info, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-info</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Light</button> @Html.UiBadge(new UiBadgeOptions { Content = "45", Color = UiBadgeColor.Light, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-light</code></div>
</div>
<div class="badge-showcase">
<span class="ui-badge-host"><button type="button" class="ui-btn">Dark</button> @Html.UiBadge(new UiBadgeOptions { Content = "50", Color = UiBadgeColor.Dark, Position = UiBadgePosition.Notification })</span>
<div class="text"><code>.ui-badge-dark</code></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/Types.cshtml; it draws what ViewData holds.
public ActionResult Types()
{
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>
The badge supports 8 different essential colours for various situations. They are listed below. All the class needs to be added along with the .e-badge class.
- Primary -
.e-badge-primaryclass applies the primary color. - Secondary -
.e-badge-secondaryclass applies the secondary color. - Success -
.e-badge-successclass applies the success color. - Danger-
.e-badge-dangerclass applies the danger color. - Warning -
.e-badge-warningclass applies the warning color. - Info -
.e-badge-infoclass applies the info color. - Light -
.e-badge-lightclass applies the light color. - Dark-
.e-badge-darkclass applies the dark color.