Timeline visualizes a series of chained events.
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!
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!
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!
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!
import { Timeline } from 'primereact/timeline';
<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/timeline/timeline.min.js"></script>
Timeline receives the events with the value property as a collection of arbitrary objects. In addition, content property is required to display the representation of an event. Example below is a sample events array that is used throughout the documentation.
const events = [
{ status: 'Ordered', date: '15/10/2020 10:30', icon: 'pi pi-shopping-cart', color: '#9C27B0', image: 'game-controller.jpg' },
{ status: 'Processing', date: '15/10/2020 14:00', icon: 'pi pi-cog', color: '#673AB7' },
{ status: 'Shipped', date: '15/10/2020 16:15', icon: 'pi pi-shopping-cart', color: '#FF9800' },
{ status: 'Delivered', date: '16/10/2020 10:00', icon: 'pi pi-check', color: '#607D8B' }
];
<Timeline value={events} content={(item) => item.status} />
Default layout of the timeline is vertical, setting layout to "horizontal" displays the items horizontally.
<Timeline value={events} layout="horizontal" content={(item) => item.status} />
Location of the timeline bar is defined using the align property.
<Timeline value={events} align="right" content={(item) => item.status} />
In addition, the "alternate" alignment option make the contents take turns around the timeline bar.
<Timeline value={events} align="alternate" content={(item) => item.status} />
Content to be placed at the other side of the bar is defined with the opposite property.
<Timeline value={events} opposite={(item) => item.status} content={(item) => <small className="p-text-secondary">{item.date}</small>} />
marker property allows placing a custom event marker instead of the default one. Below is an example with custom markers and content.
<Timeline value={events} marker={(item) => <i className={item.icon}></i>} content={(item) => item.status}} />
Name | Type | Default | Description |
---|---|---|---|
id | string | null | Unique identifier of the element. |
value | array | null | An array of events to display. |
align | string | left | Position of the timeline bar relative to the content. Valid values are "left", "right for vertical layout and "top", "bottom" for horizontal layout. |
layout | string | vertical | Orientation of the timeline, valid values are "vertical" and "horizontal". |
dataKey | string | null | Name of the field that uniquely identifies the a record in the data. |
style | string | null | Inline style of the component. |
className | string | null | Style class of the component. |
Following is the list of structural style classes, for theming classes visit theming page.
Name | Element |
---|---|
p-timeline | Container element. |
p-timeline-left | Container element when alignment is left. |
p-timeline-right | Container element when alignment is right. |
p-timeline-top | Container element when alignment is top. |
p-timeline-bottom | Container element when alignment is bottom. |
p-timeline-alternate | Container element when alignment is alternating. |
p-timeline-vertical | Container element of a vertical timeline. |
p-timeline-horizontal | Container element of a horizontal timeline. |
p-timeline-event | Event element. |
p-timeline-event-opposite | Opposite of an event content. |
p-timeline-event-content | Event content. |
p-timeline-event-separator | Separator element of an event. |
p-timeline-event-marker | Marker element of an event. |
p-timeline-event-connector | Connector element of an event. |
This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.
None.
Built-in component themes created by the PrimeReact Theme Designer.
Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.
Beautifully crafted premium create-react-app application templates by the PrimeTek design team.