Mermaid timeline examples

A mermaid timeline starts with the timeline keyword, followed by an optional title and one line per time period — period : event, with extra colons for extra events. Every example below is rendered live from the code next to it, and the copy button on each one copies it as a ready ```mermaid code block for Markdown. The first four cover the syntax; the five after the line-by-line reference are complete timelines for common cases. Updated .

Basic timeline

The whole syntax in four lines: the timeline keyword, an optional title, then one time period per line with events after colons.

timeline
    title History of Social Media
    2002 : LinkedIn founded
    2004 : Facebook launches
    2006 : Twitter goes live
    2010 : Instagram appears

Multiple events per period

Chain extra events onto one period with additional colons — either on the same line or indented on the following lines.

timeline
    title Product Year One
    Q1 : Prototype built
       : First user interviews
    Q2 : Private beta
       : Pricing decided
    Q3 : Public launch
       : First 1,000 users
    Q4 : Break even

Sections (eras)

Group periods into named eras with the section keyword. Each section gets its own background color band automatically.

timeline
    title Programming Languages by Era
    section Foundations
        1957 : Fortran
        1972 : C
    section Object Orientation
        1983 : C++
        1995 : Java : JavaScript
    section Modern Era
        2009 : Go
        2014 : Swift

Project roadmap

Timelines read better than Gantt charts for high-level roadmaps where exact durations don’t matter — only order and grouping do.

timeline
    title Migration Roadmap
    section Preparation
        Week 1 : Audit current schema
        Week 2 : Write migration scripts
               : Set up staging
    section Execution
        Week 3 : Dry run on staging
        Week 4 : Production migration
    section Cleanup
        Week 5 : Remove legacy tables
               : Retro

Mermaid timeline syntax, line by line

Every line of a timeline is one of a handful of statements. The table lists each kind in the order it usually appears, using lines from the examples on this page.

LineWhat it does
timelineAlways the first line. timeline TD draws the diagram top-down instead of left to right (Mermaid 11.14 or later).
title History of the WebOptional. Everything after title becomes the heading above the diagram.
section DiscoveryOptional. Starts a named group: every period until the next section line belongs to it and shares its colour.
1991 : First websiteA time period, then a colon with a space on each side, then an event. Both are plain text, so a period can be a year, a date, a quarter or a step name.
1991 : First website : First browserSeveral events on one line, each introduced by another colon.
: Another eventA line that starts with a colon adds one more event to the period above it. Indentation is cosmetic.
%% draft, check datesA comment. Lines starting with %% are ignored.
accTitle: Web historyAn accessible title read by screen readers; accDescr: adds a description. Neither is drawn.
Sea levels rise.<br>Britain becomes an islandText wraps on its own; <br> forces a line break inside an event or a section label.

Three rules cover most mistakes. The colon that separates a period from its events, and events from each other, needs a space after it: 2002 : LinkedIn works and 2002 :LinkedIn is a parse error, while a colon followed by a space inside event text, as in “Launch: v2”, silently splits it into two events (times such as 09:30 are fine). Order is drawing order: the first period is drawn at the left and the first event of a period at the top, and nothing is sorted. And a # inside a period label starts a comment, so “Sprint #3” loses everything from the hash on; write “Sprint 3” instead.

Full reference with every keyword and option: Mermaid timeline syntax on ChartCraft · Mermaid documentation: Timeline.

Timeline examples you can copy for common cases

Five complete timelines for the things people most often draw: a history with several events per year, project milestones grouped by phase, a step-by-step process, the fenced code block that goes into a Markdown file, and a timeline in your own colours. Copy one and replace the text.

History timeline with events per year

One line per year, and a colon for every event that happened in it. Events for the same year can share the line or continue on indented lines that start with a colon; Mermaid stacks them top to bottom under the year.

timeline
    title History of the Web
    1989 : Tim Berners-Lee proposes the World Wide Web
    1991 : First website goes live at CERN
         : WorldWideWeb browser released
    1993 : Mosaic browser
         : CERN puts the Web in the public domain
    1994 : Netscape Navigator
         : W3C founded
    1998 : Google founded
    2004 : First Web 2.0 conference : Firefox 1.0

Years are plain text, so gaps between them are not drawn to scale: 1994 and 1998 sit next to each other. Long event text wraps inside its box; force a break with <br> where you want one.

Project milestones with sections

A section per project phase, a period per milestone date, and the deliverable as the event. Each section becomes a labelled, coloured band and the milestones under it share that colour.

timeline
    title Website Relaunch Milestones
    section Discovery
        Jan 12 : Kickoff
        Feb 2 : Research complete
    section Build
        Mar 2 : Alpha
        Apr 6 : Beta : Content frozen
    section Launch
        May 4 : General availability
        May 18 : Retrospective

Sections and milestones appear in the order written, nothing is sorted. If the spacing between dates matters, draw the same milestones as a milestones-only Gantt chart, which puts them on a real date axis.

Step-by-step process timeline

Periods do not have to be dates. Label them Step 1, Step 2 and so on and list each step’s tasks as events, and the timeline becomes a process diagram read left to right.

timeline
    title Pull Request Review Process
    Step 1 : Open the pull request
           : Fill in the template
    Step 2 : Automated checks run
    Step 3 : Reviewer assigned
           : Changes requested
    Step 4 : Approvals collected
    Step 5 : Squash and merge
           : Branch deleted

Without sections, every step gets its own colour. To give the steps one shared colour, see the colours example below. For tasks with durations and dependencies, a Gantt chart is the better fit (compared at the end of this page).

Timeline inside a markdown code block

This is the block exactly as it goes into a README, issue, wiki page or note: a fenced code block tagged mermaid with the timeline inside. The code box shows the fence; the diagram under it is what the block renders as.

```mermaid
timeline
    title Release History
    v1.0 : Initial release
    v1.1 : Dark mode : Export to PDF
    v2.0 : New editor
```

The fence is three backticks followed by the word mermaid on its own line, the diagram, then three closing backticks; nothing else goes inside. It renders as a diagram where Markdown is drawn with Mermaid — GitHub, GitLab, Obsidian, VS Code’s preview and Docs MD — and shows as plain code everywhere else. In Notion you pick Mermaid as a code block’s language instead of typing the fence. Platform details are on Mermaid in Markdown.

Timeline with custom colours (disableMulticolor / theme)

Colours come from the theme, not from the timeline syntax. A config block at the top of the diagram sets the theme and overrides its cScale variables: cScale0 colours the first section, cScale1 the second, and so on up to cScale11, with cScaleLabel0 to cScaleLabel11 for the text on each.

---
config:
  theme: base
  themeVariables:
    cScale0: '#4f46e5'
    cScaleLabel0: '#ffffff'
    cScale1: '#0f766e'
    cScaleLabel1: '#ffffff'
    cScale2: '#b45309'
    cScaleLabel2: '#ffffff'
---
timeline
    title Company History
    section Startup
        2019 : Founded
        2020 : Seed round
    section Growth
        2022 : Series A : 50 employees
    section Scale
        2024 : Europe launch
        2026 : 500 employees

Without sections, each period gets its own colour from the same cScale list. To give every period one colour instead, add the timeline option under config: timeline: on one line and disableMulticolor: true indented beneath it. Mermaid’s documented themes include default, neutral, dark, forest and base; base is the one meant for overriding variables. The --- config block needs Mermaid 10.5 or later; on an older renderer, delete it and the timeline still draws in the default colours.

How do you embed a timeline in markdown?

Put the code in a fenced block tagged mermaid (the copy buttons above include the fence, and the code block example shows the block exactly as it goes into a file). GitHub, GitLab, Obsidian, VS Code's Markdown preview and Docs MD share pages render it as a diagram automatically; in Notion you choose Mermaid as a code block's language instead of typing the fence. Paste one into the editor here to see it live, check the full fence syntax on the cheat sheet, or see the per-platform notes on Mermaid in Markdown.

Why is my timeline not rendering?

The usual causes: the renderer ships a mermaid version older than 9.4 (when timeline landed), or older than what an option needs — timeline TD is 11.14 and the --- config block is 10.5; the fence is tagged with nothing or text instead of mermaid; or a colon is missing its space — 2002 :LinkedIn fails to parse. A colon with a space inside an event does not stop the drawing but splits the event in two, so write “Launch — v2” with a dash instead, and a # in a period label cuts the line short. Long event text wraps automatically, but very long period labels don't; keep periods short. To find the broken line, paste the block into the editor, which shows the parser's error.

Timeline vs Gantt — which should you use?

A timeline shows what happened when — discrete periods with events, no durations or dependencies. A Gantt chart (mermaid's gantt keyword) models start dates, durations, and task dependencies. If your data is “era → things that happened”, timeline reads far better; if it's “task A blocks task B”, use Gantt. The middle ground is a Gantt chart made only of milestones, which keeps the timeline look but spaces events by their real dates; see the milestones example on the Gantt page.

More Mermaid examples

Gantt chart · Pie chart · Mindmap · Git graph · Mermaid in Markdown