Reference
Timeline
The timeline displays a list of events in chronological order.
This component is not documented in the Material Design guidelines, but it is available in Material UI.
Basic timeline
A basic timeline showing list of events.
- Eat
- Code
- Sleep
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function BasicTimeline() { return ( <Timeline> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Sleep</TimelineContent> </TimelineItem> </Timeline> ); }
Left-positioned timeline
The main content of the timeline can be positioned on the left side relative to the time axis.
- Eat
- Code
- Sleep
- Repeat
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function LeftPositionedTimeline() { return ( <Timeline position="left"> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Sleep</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Repeat</TimelineContent> </TimelineItem> </Timeline> ); }
Alternating timeline
The timeline can display the events on alternating sides.
- Eat
- Code
- Sleep
- Repeat
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function AlternateTimeline() { return ( <Timeline position="alternate"> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Sleep</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Repeat</TimelineContent> </TimelineItem> </Timeline> ); }
Reverse Alternating timeline
The timeline can display the events on alternating sides in reverse order.
- Eat
- Code
- Sleep
- Repeat
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function AlternateReverseTimeline() { return ( <Timeline position="alternate-reverse"> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Sleep</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Repeat</TimelineContent> </TimelineItem> </Timeline> ); }
Color
The
TimelineDot
can appear in different colors from theme palette.- Secondary
- Success
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function ColorsTimeline() { return ( <Timeline position="alternate"> <TimelineItem> <TimelineSeparator> <TimelineDot color="secondary" /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Secondary</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot color="success" /> </TimelineSeparator> <TimelineContent>Success</TimelineContent> </TimelineItem> </Timeline> ); }
Outlined
- Eat
- Code
- Sleep
- Repeat
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function OutlinedTimeline() { return ( <Timeline position="alternate"> <TimelineItem> <TimelineSeparator> <TimelineDot variant="outlined" /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot variant="outlined" color="primary" /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot variant="outlined" color="secondary" /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Sleep</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot variant="outlined" /> </TimelineSeparator> <TimelineContent>Repeat</TimelineContent> </TimelineItem> </Timeline> ); }
Opposite content
The timeline can display content on opposite sides.
- 09:30 amEat
- 10:00 amCode
- 12:00 amSleep
- 9:00 amRepeat
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; import TimelineOppositeContent from '@mui/lab/TimelineOppositeContent'; export default function OppositeContentTimeline() { return ( <Timeline position="alternate"> <TimelineItem> <TimelineOppositeContent color="text.secondary"> 09:30 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineOppositeContent color="text.secondary"> 10:00 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> <TimelineItem> <TimelineOppositeContent color="text.secondary"> 12:00 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Sleep</TimelineContent> </TimelineItem> <TimelineItem> <TimelineOppositeContent color="text.secondary"> 9:00 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Repeat</TimelineContent> </TimelineItem> </Timeline> ); }
Customization
Here is an example of customizing the component. You can learn more about this in the overrides documentation page.
- 9:30 amEat
Because you need strength
- 10:00 amCode
Because it's awesome!
- Sleep
Because you need rest
- Repeat
Because this is the life you love!
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineOppositeContent from '@mui/lab/TimelineOppositeContent'; import TimelineDot from '@mui/lab/TimelineDot'; import FastfoodIcon from '@mui/icons-material/Fastfood'; import LaptopMacIcon from '@mui/icons-material/LaptopMac'; import HotelIcon from '@mui/icons-material/Hotel'; import RepeatIcon from '@mui/icons-material/Repeat'; import Typography from '@mui/material/Typography'; export default function CustomizedTimeline() { return ( <Timeline position="alternate"> <TimelineItem> <TimelineOppositeContent sx={{ m: 'auto 0' }} align="right" variant="body2" color="text.secondary" > 9:30 am </TimelineOppositeContent> <TimelineSeparator> <TimelineConnector /> <TimelineDot> <FastfoodIcon /> </TimelineDot> <TimelineConnector /> </TimelineSeparator> <TimelineContent sx={{ py: '12px', px: 2 }}> <Typography variant="h6" component="span"> Eat </Typography> <Typography>Because you need strength</Typography> </TimelineContent> </TimelineItem> <TimelineItem> <TimelineOppositeContent sx={{ m: 'auto 0' }} variant="body2" color="text.secondary" > 10:00 am </TimelineOppositeContent> <TimelineSeparator> <TimelineConnector /> <TimelineDot color="primary"> <LaptopMacIcon /> </TimelineDot> <TimelineConnector /> </TimelineSeparator> <TimelineContent sx={{ py: '12px', px: 2 }}> <Typography variant="h6" component="span"> Code </Typography> <Typography>Because it's awesome!</Typography> </TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineConnector /> <TimelineDot color="primary" variant="outlined"> <HotelIcon /> </TimelineDot> <TimelineConnector sx={{ bgcolor: 'secondary.main' }} /> </TimelineSeparator> <TimelineContent sx={{ py: '12px', px: 2 }}> <Typography variant="h6" component="span"> Sleep </Typography> <Typography>Because you need rest</Typography> </TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineConnector sx={{ bgcolor: 'secondary.main' }} /> <TimelineDot color="secondary"> <RepeatIcon /> </TimelineDot> <TimelineConnector /> </TimelineSeparator> <TimelineContent sx={{ py: '12px', px: 2 }}> <Typography variant="h6" component="span"> Repeat </Typography> <Typography>Because this is the life you love!</Typography> </TimelineContent> </TimelineItem> </Timeline> ); }
Alignment
There are different ways in which a Timeline can be placed within the container.
You can do it by overriding the styles.
A Timeline centers itself in the container by default.
The demos below show how to adjust the relative width of the left and right sides of a Timeline:
Left-aligned
- 09:30 amEat
- 10:00 amCode
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; import TimelineOppositeContent, { timelineOppositeContentClasses, } from '@mui/lab/TimelineOppositeContent'; export default function LeftAlignedTimeline() { return ( <Timeline sx={{ [`& .${timelineOppositeContentClasses.root}`]: { flex: 0.2, }, }} > <TimelineItem> <TimelineOppositeContent color="textSecondary"> 09:30 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineOppositeContent color="textSecondary"> 10:00 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> </Timeline> ); }
Right-aligned
- 09:30 amEat
- 10:00 amCode
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent, { timelineContentClasses } from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; import TimelineOppositeContent from '@mui/lab/TimelineOppositeContent'; export default function RightAlignedTimeline() { return ( <Timeline sx={{ [`& .${timelineContentClasses.root}`]: { flex: 0.2, }, }} > <TimelineItem> <TimelineOppositeContent color="textSecondary"> 09:30 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineOppositeContent color="textSecondary"> 10:00 am </TimelineOppositeContent> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> </Timeline> ); }
Left-aligned with no opposite content
- Eat
- Code
import * as React from 'react'; import Timeline from '@mui/lab/Timeline'; import TimelineItem, { timelineItemClasses } from '@mui/lab/TimelineItem'; import TimelineSeparator from '@mui/lab/TimelineSeparator'; import TimelineConnector from '@mui/lab/TimelineConnector'; import TimelineContent from '@mui/lab/TimelineContent'; import TimelineDot from '@mui/lab/TimelineDot'; export default function NoOppositeContent() { return ( <Timeline sx={{ [`& .${timelineItemClasses.root}:before`]: { flex: 0, padding: 0, }, }} > <TimelineItem> <TimelineSeparator> <TimelineDot /> <TimelineConnector /> </TimelineSeparator> <TimelineContent>Eat</TimelineContent> </TimelineItem> <TimelineItem> <TimelineSeparator> <TimelineDot /> </TimelineSeparator> <TimelineContent>Code</TimelineContent> </TimelineItem> </Timeline> ); }