Example of Card in ASP.NET MVC Avatar Control
This sample demonstrates the integration of Avatar component with card component to create business cards.
Laura Callahan
Sales Coordinator
Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.
@Html.UiAvatar(new UiAvatarOptions { ImageUrl = Url.Content("~/Content/avatar/images/pic02.png"), Size = UiAvatarSize.XLarge, Shape = UiAvatarShape.Circle, Title = "Profile picture" })
<style>
.sample_container { margin: 0 auto; }
.avatar-block { display: inline-block; vertical-align: top; }
.avatar-showcase { display: block; box-sizing: border-box; padding: 5px; margin: 5px; border: 1px solid var(--ui-border); border-radius: 8px; background: var(--ui-surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); }
.avatar-showcase .card-content { display: flex; align-items: center; justify-content: space-evenly; gap: 6px; padding: 10px 0; text-align: center; }
.avatar-showcase .card-content .ui-avatar { font-size: 18px; }
.avatar-sub-block { display: inline-block; position: relative; margin: 7px; }
.e-custom-card { margin: 30px auto; }
.e-custom-card .name { font-size: 18px; letter-spacing: 1px; }
.e-custom-card .card-sub-title { color: var(--ui-muted); font-size: 14px; }
.e-custom-card .avatar-content { margin: 0; text-align: center; font-size: 14px; }
</style>
<div class="control-section">
<div class="sample_container">
<div class="avatar-showcase e-custom-card" style="width: 300px">
<div class="card-header" style="text-align: center; padding-top: 10px">
@Html.UiAvatar(new UiAvatarOptions { ImageUrl = Url.Content("~/Content/avatar/images/pic02.png"), Size = UiAvatarSize.XLarge, Shape = UiAvatarShape.Circle, Title = "Profile picture" })
</div>
<div class="card-header" style="text-align: center">
<div class="name">Laura Callahan</div>
<div class="card-sub-title">Sales Coordinator</div>
</div>
<div class="card-content" style="display: block">
<p class="avatar-content">Laura received a BA in psychology from the University of Washington. She has also completed a course in business French. She reads and writes French.</p>
</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 AvatarController : Controller
{
// The page is Views/Avatar/Card.cshtml; it draws what ViewData holds.
public ActionResult Card()
{
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 circle avatar is integrated into card component to design business cards. The image element is wrapped by the avatar container to apply circle style to avatar add .e-badge-circle to the avatar container.