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!
+ + +
+
+import Timeline from 'primevue/timeline';
+
+
+
+ Timeline receives the events with the value property as a collection of arbitrary objects. In addition, content template is required to display the representation of an event. + Example below is a sample events array that is used throughout the documentation.
+
+
+export default {
+ data() {
+ return {
+ 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'}
+ ],
+ events2: [
+ "2020", "2021", "2022", "2023"
+ ]
+ }
+ }
+}
+
+
+
+
+
+<Timeline :value="events">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+</Timeline>
+
+
+
+ Default layout of the timeline is vertical, setting layout to "horizontal" displays the items horizontally.
+
+
+<Timeline :value="events">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+</Timeline>
+
+
+
+ Location of the timeline bar is defined using the align property.
+
+
+<Timeline :value="events" align="right">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+</Timeline>
+
+
+
+ In addition, the "alternate" alignment option make the contents take turns around the timeline bar.
+
+
+<Timeline :value="events" align="alternate">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+</Timeline>
+
+
+
+ Content to be placed at the other side of the bar is defined with the opposite template.
+
+
+<Timeline :value="events">
+ <template #opposite="slotProps">
+ <small class="p-text-secondary">{{slotProps.item.date}}</small>
+ </template>
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+</Timeline>
+
+
+
+ marker template allows placing a custom event marker instead of the default one. Below is an example with custom markers and content.
+
+
+<Timeline :value="events" align="alternate" class="customized-timeline">
+ <template #marker="slotProps">
+ <span class="custom-marker p-shadow-2" :style="{backgroundColor: slotProps.item.color}">
+ <i :class="slotProps.item.icon"></i>
+ </span>
+ </template>
+ <template #content="slotProps">
+ <Card>
+ <template #title>
+ {{slotProps.item.status}}
+ </template>
+ <template #subtitle>
+ {{slotProps.item.date}}
+ </template>
+ <template #content>
+ <img v-if="slotProps.item.image" :src="'demo/images/product/' + slotProps.item.image" :alt="slotProps.item.name" width="200" class="p-shadow-2" />
+ <p>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!</p>
+ <Button label="Read more" class="p-button-text"></Button>
+ </template>
+ </Card>
+ </template>
+</Timeline>
+
+
+
+ Name | +Type | +Default | +Description | +
---|---|---|---|
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. | +
Following is the list of structural style classes, for theming classes visit
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. | +
None.
+
+
+<div class="card">
+ <h5>Left Align</h5>
+ <Timeline :value="events1">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+ </Timeline>
+</div>
+
+<div class="card">
+ <h5>Right Align</h5>
+ <Timeline :value="events1" align="right">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+ </Timeline>
+</div>
+
+<div class="card">
+ <h5>Alternate Align</h5>
+ <Timeline :value="events1" align="alternate">
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+ </Timeline>
+</div>
+
+<div class="card">
+ <h5>Opposite Content</h5>
+ <Timeline :value="events1">
+ <template #opposite="slotProps">
+ <small class="p-text-secondary">{{slotProps.item.date}}</small>
+ </template>
+ <template #content="slotProps">
+ {{slotProps.item.status}}
+ </template>
+ </Timeline>
+</div>
+
+<div class="card">
+ <h5>Customized</h5>
+ <Timeline :value="events1" align="alternate" class="customized-timeline">
+ <template #marker="slotProps">
+ <span class="custom-marker p-shadow-2" :style="{backgroundColor: slotProps.item.color}">
+ <i :class="slotProps.item.icon"></i>
+ </span>
+ </template>
+ <template #content="slotProps">
+ <Card>
+ <template #title>
+ {{slotProps.item.status}}
+ </template>
+ <template #subtitle>
+ {{slotProps.item.date}}
+ </template>
+ <template #content>
+ <img v-if="slotProps.item.image" :src="'demo/images/product/' + slotProps.item.image" :alt="slotProps.item.name" width="200" class="p-shadow-2" />
+ <p>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!</p>
+ <Button label="Read more" class="p-button-text"></Button>
+ </template>
+ </Card>
+ </template>
+ </Timeline>
+</div>
+
+<div class="card">
+ <h5>Horizontal</h5>
+ <h6>Top Align</h6>
+ <Timeline :value="events2" layout="horizontal" align="top">
+ <template #content="slotProps">
+ {{slotProps.item}}
+ </template>
+ </Timeline>
+
+ <h6>Bottom Align</h6>
+ <Timeline :value="events2" layout="horizontal" align="bottom">
+ <template #content="slotProps">
+ {{slotProps.item}}
+ </template>
+ </Timeline>
+
+ <h6>Alternate Align</h6>
+ <Timeline :value="events2" layout="horizontal" align="alternate">
+ <template #content="slotProps">
+ {{slotProps.item}}
+ </template>
+ </Timeline>
+</div>
+
+
+
+
+
+export default {
+ data() {
+ return {
+ events1: [
+ {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'}
+ ],
+ events2: [
+ "2020", "2021", "2022", "2023"
+ ]
+ }
+ }
+}
+
+
+