Example of Default Functionalities in ASP.NET MVC Timeline Control
This sample demonstrates the default functionalities of the Timeline control including the highlighted customization.
- Ordered
9:15 AM, January 1, 2024 - Shipped
12:20 PM, January 4, 2024 - Out for delivery
07:00 AM, January 8, 2024 - Delivered
Estimated delivery by 09:20 AM
@Html.UiTimeline(new UiTimelineOptions { Id = "default", Items = (List<UiTimelineItem>)ViewData["CustomData"] })
<style>
.default-timeline-section { max-width: 360px; margin: 40px auto; }
.default-timeline-section .ui-opposite-content:empty, .timeline-template-section .ui-opposite-content:empty { display: none; }
.default-timeline-section .ui-content { white-space: nowrap; }
.default-timeline-section .completed .ui-content, .default-timeline-section .intermediate .ui-content { font-weight: 500; }
</style>
<div class="control-section">
<div class="default-timeline-section">
@Html.UiTimeline(new UiTimelineOptions { Id = "default", Items = (List<UiTimelineItem>)ViewData["CustomData"] })
</div>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Lumen.UI.Mvc;
namespace YourApp.Controllers
{
public class TimelineController : Controller
{
// The page is Views/Timeline/Default.cshtml; it draws what ViewData holds.
public ActionResult Default()
{
ViewData["CustomData"] = new List<UiTimelineItem>
{
new UiTimelineItem { HtmlContent = new HtmlString("Ordered<br />9:15 AM, January 1, 2024"), DotCss = "ui-dot-success", CssClass = "completed" },
new UiTimelineItem { HtmlContent = new HtmlString("Shipped<br />12:20 PM, January 4, 2024"), DotCss = "ui-dot-success", CssClass = "completed" },
new UiTimelineItem { HtmlContent = new HtmlString("Out for delivery<br />07:00 AM, January 8, 2024"), DotCss = "ui-dot-accent", CssClass = "intermediate" },
new UiTimelineItem { HtmlContent = new HtmlString("Delivered<br />Estimated delivery by 09:20 AM"), }
};
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 Timeline control enables users to display a series of data in chronological order, such as user activities, tracking progress, and more. In this example, we have used the content property to display the item's content, dotCss property to customize the dot with background color and cssClass to customize the last connector as dashed style.