How can I help you?
Customization in ASP.NET MVC Timeline control
30 Jan 202510 minutes to read
You can customize the Timeline items dot size, connectors, dot borders, dot outer space and more to personalize its appearance. This section explains the different ways for styling the items.
Connector styling
Common styling
You can define the styles applicable to the all the Timeline item connectors.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("custom-connector").Items(ViewBag.dailyRoutine).Render()
</div>
<style>
.custom-connector .e-timeline-item.e-connector::after {
border-color: #f7c867;
border-width: 1.4px;
}
</style>public ActionResult Demo()
{
List<TimelineItem> dailyRoutine = new List<TimelineItem>();
dailyRoutine.Add(new TimelineItem { Content = "Eat" });
dailyRoutine.Add(new TimelineItem { Content = "Code" });
dailyRoutine.Add(new TimelineItem { Content = "Repeat" });
ViewBag.dailyRoutine = dailyRoutine;
return View();
}
Individual styling
You can also apply unique styles to individual connectors, to differentiate specific items within the Timeline.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("custom-connector").Items(ViewBag.dailyRoutine).Render()
</div>
<style>
.custom-connector .state-initial.e-connector::after {
border: 1.5px #f8c050 dashed;
}
.custom-connector .state-intermediate.e-connector::after {
border: 1.5px #4d85f5 dashed;
}
</style>public ActionResult Demo()
{
List<TimelineItem> dailyRoutine = new List<TimelineItem>();
dailyRoutine.Add(new TimelineItem { Content = "Eat", CssClass = "state-initial" });
dailyRoutine.Add(new TimelineItem { Content = "Code", CssClass = "state-intermediate" });
dailyRoutine.Add(new TimelineItem { Content = "Repeat" });
ViewBag.dailyRoutine = dailyRoutine;
return View();
}
Dot styling
Dot color
You can modify the color of the dots to highlight the specific Timeline items.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("dot-color").Items(ViewBag.orderStatus).Render()
</div>
<style>
.dot-color .state-completed .e-dot {
background-color: #ff9900;
outline: 1px dashed #ff9900;
border-color: #ff9900;
}
.dot-color .state-progress .e-dot {
background: #33cc33;
outline: 1px dashed #33cc33;
border-color: #33cc33;
}
</style>public ActionResult Demo()
{
List<TimelineItem> orderStatus = new List<TimelineItem>();
orderStatus.Add(new TimelineItem { Content = "Ordered", CssClass = "state-completed" });
orderStatus.Add(new TimelineItem { Content = "Shipped", CssClass = "state-progress" });
orderStatus.Add(new TimelineItem { Content = "Delivered" });
ViewBag.orderStatus = orderStatus;
return View();
}
Dot size
You can adjust the size of the dot to make it larger or smaller by using the --dot-size variable.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("dot-size").Items(ViewBag.dotSizes).Render()
</div>
<style>
.dot-size .e-dot {
background: #33cc33;
}
.dot-size .x-small .e-dot {
--dot-size: 12px;
}
.dot-size .small .e-dot {
--dot-size: 18px;
}
.dot-size .medium .e-dot {
--dot-size: 24px;
}
.dot-size .large .e-dot {
--dot-size: 30px;
}
</style>public ActionResult Demo()
{
List<TimelineItem> dotSizes = new List<TimelineItem>();
dotSizes.Add(new TimelineItem { Content = "Extra Small", CssClass = "x-small" });
dotSizes.Add(new TimelineItem { Content = "Small", CssClass = "small" });
dotSizes.Add(new TimelineItem { Content = "Medium", CssClass = "medium" });
dotSizes.Add(new TimelineItem { Content = "Large", CssClass = "large" });
ViewBag.dotSizes = dotSizes;
return View();
}
Dot shadow
You can add shadow effects to the Timeline dots to make it feel visually engaging by using the --dot-outer-space & --dot-border variables.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("dot-shadow").Items(ViewBag.orderStatus).Render()
</div>
<style>
.dot-shadow .e-dot {
--dot-outer-space: 3px;
--dot-border: 3px;
--dot-size: 20px;
outline-color: #dee2e6;
border-color: #fff;
box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5), 2px -2px 4px rgba(255, 255, 255, 0.5) inset;
}
</style>public ActionResult Demo()
{
List<TimelineItem> orderStatus = new List<TimelineItem>();
orderStatus.Add(new TimelineItem { Content = "Ordered" });
orderStatus.Add(new TimelineItem { Content = "Shipped" });
orderStatus.Add(new TimelineItem { Content = "Delivered" });
ViewBag.orderStatus = orderStatus;
return View();
}
Dot variant
You can achieve the desired dot variant by customizing the border, outline and background colors of the Timeline dots.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("dot-variant").Items(ViewBag.dotVariants).Render()
</div>
<style>
.dot-variant .dot-filled .e-dot::before {
content: 'A';
color: #fff;
}
.dot-variant .dot-flat .e-dot::before {
content: 'B';
color: #fff;
}
.dot-variant .dot-outlined .e-dot::before {
content: 'C';
}
.dot-variant .dot-filled .e-dot {
background: #33cc33;
--dot-outer-space: 3px;
outline-color: #81ff05;
--dot-size: 25px;
}
.dot-variant .dot-flat .e-dot {
background: #33cc33;
--dot-size: 25px;
--dot-radius: 10%;
}
.dot-variant .dot-outlined .e-dot {
outline-color: #33cc33;
--dot-outer-space: 3px;
background-color: unset;
--dot-size: 25px;
}
</style>public ActionResult Demo()
{
List<TimelineItem> dotVariants = new List<TimelineItem>();
dotVariants.Add(new TimelineItem { Content = "Filled", CssClass = "dot-filled" });
dotVariants.Add(new TimelineItem { Content = "Flat", CssClass = "dot-flat" });
dotVariants.Add(new TimelineItem { Content = "Outlined", CssClass = "dot-outlined" });
ViewBag.dotVariants = dotVariants;
return View();
}
Dot outline
By adding the e-outline class to the Timeline cssClass property it enables the dots to have an outline state.
@using Syncfusion.EJ2.Layouts
<div id="container" style="height: 250px;">
@Html.EJS().Timeline("timeline").CssClass("e-outline").Items(ViewBag.orderStatus).Render()
</div>public ActionResult Demo()
{
List<TimelineItem> orderStatus = new List<TimelineItem>();
orderStatus.Add(new TimelineItem { Content = "Shipped" });
orderStatus.Add(new TimelineItem { Content = "Departed" });
orderStatus.Add(new TimelineItem { Content = "Arrived" });
orderStatus.Add(new TimelineItem { Content = "Out for Delivery" });
ViewBag.orderStatus = orderStatus;
return View();
}