Blazor Timeline
The Blazor Bootstrap Timeline component shows events in order along a line, vertically, horizontally, or on alternating sides, with dot, icon, or custom markers. The examples below cover placement, horizontal, alternate, icons and colors and custom markers.
INFO
Bootstrap 5.3 has no timeline component. Timeline is built from Bootstrap utilities (rounded markers,
text-bg-* colors, Bootstrap Icons)
and a small set of --bb-timeline-* CSS properties for the line and the layouts, so it follows the light and dark themes.
It renders an ordered list, so screen readers announce each item's position and the number of items.
Basic usage #
A vertical timeline with the line and markers at the start and each item's content beside them.
How to use:
How to use:
- Add
TimelinewithTimelineItemchildren, in the order the events happened. - Set
Title,Subtitle(for example a timestamp), and optional content on each item. - Set
AriaLabelto name the list for screen readers.
Placement #
Choose where the line and markers of a vertical timeline sit. Change the placement below.
How to use:
How to use:
- Set
Placement(TimelinePlacement):Start(default) puts the line at the start edge,Endat the end edge with the content aligned toward it, andAlternateorAlternateReversecenters it with the items on alternating sides. StartandEndkeep their layout at every width. Below the collapse breakpoint the alternate placements show asStart.Placementhas no effect on a horizontal timeline.
Horizontal #
Lay the items out left to right. When they do not fit, the timeline scrolls inside its own container, never the page.
How to use:
How to use:
- Set
Orientation="TimelineOrientation.Horizontal". - Below the collapse breakpoint (medium by default) it shows as a vertical timeline; see Responsive.
Alternate #
Place the items of a vertical timeline on alternating sides of a centered line. Items of different heights keep their markers on the line.
How to use:
How to use:
- Set
Placement="TimelinePlacement.Alternate"(the first item on the end side) orTimelinePlacement.AlternateReverse(the first item on the start side). It has no effect on a horizontal timeline. - Below the collapse breakpoint the items stack in one column, as with
Start.
Icons and colors #
Show an icon in the marker and color it.
How to use:
How to use:
- Set
IconNameto show a Bootstrap icon in the marker; without it the marker is a dot. - Set
Color(TimelineColor) to color the dot or icon marker. Do not rely on color alone to tell items apart; say it in the title too.
Custom markers #
Use any content as the marker, such as an
How to use:
Avatar.
How to use:
- Set
MarkerTemplate; it takes precedence overIconName, andColordoes not apply to it. - When an item also has content, put it in
ChildContent.
Current item #
Mark the item the process has reached.
How to use:
How to use:
- Set
Current="true"on one item. It is markedaria-current="step", gets a ring around its marker, and a bold title.
Responsive #
Choose the width below which a horizontal or alternate timeline shows as a single vertical column. Resize the window, or change the breakpoint below.
How to use:
How to use:
- Set
CollapseBreakpoint:Small(576px),Medium(768px, default),Large(992px),ExtraLarge(1200px),ExtraExtraLarge(1400px), orNoneto never collapse. - Above the breakpoint, a horizontal timeline whose items do not fit scrolls inside its own container.
Data binding #
Show a collection as timeline items. Add, remove, or reorder items, or move the current item, and the timeline follows.
How to use:
How to use:
- Inside
Timeline, addTimelineItemsand setData;TItemis inferred from it. - Map each part with
TitleField,SubtitleField,IconNameField,ColorField, andCurrentField. - Use
ItemTemplatefor the content andMarkerTemplatefor a custom marker. A null or emptyDatashows no items.
Static and data items #
Mix
TimelineItem components and TimelineItems in one timeline; they show in markup order.
Nested #
A timeline inside an item keeps its own orientation, layout, alignment, and current item, even inside an alternate timeline.