Diagrams / Mermaid Gantt Chart: Syntax & Examples

Mermaid Gantt Chart: Syntax & Examples

Explore Mermaid Gantt syntax with task dates, durations and dependencies. Review sections, excluded days and a working project schedule example.

When to use Gantt Chart

Use a Mermaid Gantt chart to communicate planned task dates, durations, and dependencies. Group related tasks into sections and show milestones that matter to the audience. The chart is a schedule description, not a live project management system.

Read the Gantt Chart example

Diagram source

gantt
    title Documentation Launch Plan
    dateFormat  YYYY-MM-DD
    section Plan
    Outline examples      :done, p1, 2026-05-01, 2d
    Review syntax         :done, p2, after p1, 1d
    section Build
    Create diagrams       :active, b1, 2026-05-04, 3d
    Publish docs          :b2, after b1, 1d
Planning tasks finish before diagram production begins. An after reference ties a task to a predecessor; an explicit date fixes its start independently. Read those choices as scheduling assumptions that may need review.

Syntax and interpretation

ConceptHow to apply it
Date formatDeclare the input date format and use it consistently across the schedule.
Task IDsGive dependent tasks stable IDs. Labels can change while dependency references remain understandable.
Excluded daysExcluding days affects scheduling. Check rendered start and finish dates instead of assuming a three-day task always spans three calendar days.

Common questions

Can I show a history instead of a plan?

Yes, but a timeline is usually simpler for a sequence of completed milestones. Use Gantt when the duration and overlap of activities are important.