Timeline

Timeline visualizes a series of chained events.


import { Timeline } from 'primereact/timeline';
         

Timeline requires a value for the collection of events and content function that receives an object as a parameter to return content.

Ordered
Processing
Shipped
Delivered

<Timeline value={events} content={(item) => item.status} />
         

Content location relative the line is defined with the align property.

Ordered
Processing
Shipped
Delivered
Ordered
Processing
Shipped
Delivered
Ordered
Processing
Shipped
Delivered

<Timeline value={events} content={(item) => item.status} className="w-full md:w-20rem" />
<Timeline value={events} align="right" content={(item) => item.status} className="w-full md:w-20rem" />
<Timeline value={events} align="alternate" content={(item) => item.status} className="w-full md:w-20rem" />
         

Additional content at the other side of the line can be provided with the opposite property.

Ordered
15/10/2020 10:30
Processing
15/10/2020 14:00
Shipped
15/10/2020 16:15
Delivered
16/10/2020 10:00

<Timeline value={events} opposite={(item) => item.status} 
    content={(item) => <small className="text-color-secondary">{item.date}</small>} />
         

Sample implementation with custom content and styled markers.

Ordered
15/10/2020 10:30

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!

Processing
15/10/2020 14:00

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!

Shipped
15/10/2020 16:15

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!

Delivered
16/10/2020 10:00

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!


<Timeline value={events} align="alternate" className="customized-timeline" 
    marker={customizedMarker} content={customizedContent} />
         

TimeLine orientation is controlled with the layout property, default is vertical having horizontal as the alternative.

2020
2021
2022
2023
2020
2021
2022
2023
 
2020
 
2021
 
2022
 
2023

<Timeline value={events} layout="horizontal" align="top" content={(item) => item} />
<Timeline value={events} layout="horizontal" align="bottom" content={(item) => item} />
<Timeline value={events} layout="horizontal" align="alternate" content={(item) => item} opposite={<span>&nbsp;</span>} />
         

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-timelineContainer element.
p-timeline-leftContainer element when alignment is left.
p-timeline-rightContainer element when alignment is right.
p-timeline-topContainer element when alignment is top.
p-timeline-bottomContainer element when alignment is bottom.
p-timeline-alternateContainer element when alignment is alternating.
p-timeline-verticalContainer element of a vertical timeline.
p-timeline-horizontalContainer element of a horizontal timeline.
p-timeline-eventEvent element.
p-timeline-event-oppositeOpposite of an event content.
p-timeline-event-contentEvent content.
p-timeline-event-separatorSeparator element of an event.
p-timeline-event-markerMarker element of an event.
p-timeline-event-connectorConnector element of an event.
Accessibility guide documents the specification of this component based on WCAG guidelines, the implementation is in progress.

Screen Reader

Timeline uses a semantic ordered list element to list the events. No specific role is enforced, still you may use any aria role and attributes as any valid attribute is passed to the list element.

Keyboard Support

Component does not include any interactive elements.