Search results

Timeline

The Timeline component presents a series of events or activities in chronological order, allowing users to track the progression of time.

<div id="timeline"></div>
<script>
  let timelineObj: Timeline = new Timeline({items : [{}, {}, {}, {}, {}]});
  timelineObj.appendTo('#timeline');
</script>

Properties

align

string | TimelineAlign

Defines the alignment of item content within the Timeline. The possible values are:

  • Before
  • After
  • Alternate
  • AlternateReverse
    <div id="timeline"> </div>
import { Timeline, ItemModel } from '@syncfusion/ej2-layouts';

const textContent: ItemModel[] = [
    { content: 'Cart' },
    { content: 'Personal Info' },
    { content: 'Delivery Address' },
    { content: 'Payment' }
];

let timelineObj: Timeline = new Timeline({
    items : textContent,
    align: 'before'
});
timelineObj.appendTo('#timeline');

Defaults to TimelineAlign.After

cssClass

string

Defines the CSS class to customize the Timeline appearance.

Defaults to

enablePersistence

boolean

Enable or disable persisting component’s state between page reloads.

Defaults to false

enableRtl

boolean

Enable or disable rendering component in right to left direction.

Defaults to false

items

TimelineItemModel[]

Defines the list of items.

Defaults to []

locale

string

Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.

Defaults to

orientation

string | TimelineOrientation

Defines the orientation type of the Timeline. The possible values are:

  • Horizontal
  • vertical
    <div id="timeline"> </div>
import { Timeline } from '@syncfusion/ej2-layouts';

let timelineObj: Timeline = new Timeline({
    items: [{}, {}, {}, {}],
    orientation: 'horizontal'
});
timelineObj.appendTo('#timeline');

Defaults to TimelineOrientation.Vertical

reverse

boolean

Defines whether to show the timeline items in reverse order or not.

Defaults to false

template

string | Function

Defines the template content for each timeline item. The template context will contain the item model.

    <div id="timeline"> </div>
import { Timeline } from '@syncfusion/ej2-layouts';

let timelineObj: Timeline = new Timeline({
    items: [{}, {}, {}, {}],
    template: '<span>${currentItem}</span>'
});
timelineObj.appendTo('#timeline');

Defaults to

Methods

addEventListener

Adds the handler to the given event listener.

Parameter Type Description
eventName string A String that specifies the name of the event
handler Function Specifies the call to run when the event occurs.

Returns void

appendTo

Appends the control within the given HTML element

Parameter Type Description
selector (optional) string | HTMLElement Target element where control needs to be appended

Returns void

attachUnloadEvent

Adding unload event to persist data when enable persistence true

Returns void

dataBind

When invoked, applies the pending property changes immediately to the component.

Returns void

detachUnloadEvent

Removing unload event to persist data when enable persistence true

Returns void

getLocalData

Returns the persistence data for component

Returns any

getRootElement

Returns the route element of the component

Returns HTMLElement

handleUnload

Handling unload event to persist data when enable persistence true

Returns void

refresh

Applies all the pending property changes and render the component again.

Returns void

removeEventListener

Removes the handler from the given event listener.

Parameter Type Description
eventName string A String that specifies the name of the event to remove
handler Function Specifies the function to remove

Returns void

Inject

Dynamically injects the required modules to the component.

Parameter Type Description
moduleList Function[] ?

Returns void

Events

beforeItemRender

EmitType<TimelineRenderingEventArgs>

Event triggers before rendering each item.

created

EmitType<Event>

Event callback that is raised after rendering the timeline.