Mermaid provides accessibility features to make diagrams usable with assistive technologies and improve SEO. These features follow W3C’s Accessible Rich Internet Applications (ARIA) standards.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mermaid-js/mermaid/llms.txt
Use this file to discover all available pages before exploring further.
Automatic ARIA attributes
Mermaid automatically adds accessibility attributes to diagram SVG elements:- aria-roledescription - Set to the diagram type (e.g., “flowchart-v2”, “sequenceDiagram”)
- aria-labelledby - References the accessible title element
- aria-describedby - References the accessible description element
Example SVG output
Accessible titles
Use theaccTitle keyword to add an accessible title to your diagram. The title appears in the <title> element and is announced by screen readers.
Syntax
Example
This generates:Accessible descriptions
Use theaccDescr keyword to add a detailed description of your diagram. Descriptions can be single-line or multi-line.
Single-line description
Multi-line description
For longer descriptions, omit the colon and use curly brackets:Example with multi-line description
This generates:Examples by diagram type
Flowchart
Sequence diagram
Class diagram
Entity relationship diagram
Gantt chart
Git graph
Pie chart
State diagram
User journey
Requirement diagram
Best practices
- Always provide titles - Screen readers announce titles when focusing on diagrams
- Write meaningful descriptions - Describe the purpose and key information, not just the visual structure
- Keep titles concise - Titles should be brief (1-10 words)
- Use multi-line for complex diagrams - Longer descriptions help users understand intricate diagrams
- Test with screen readers - Verify your accessibility features work with actual assistive technology
Benefits
For users with disabilities
- Screen readers can announce diagram titles and descriptions
- Alternative text provides context when visuals aren’t accessible
- ARIA attributes help assistive technologies understand diagram structure
For all users
- Better SEO - Search engines index title and description content
- Improved documentation - Descriptions serve as documentation
- Context for complex diagrams - Helps everyone understand the diagram’s purpose
Testing accessibility
To verify your accessibility features:- Inspect the HTML - Check that
<title>and<desc>elements are present - Use a screen reader - Test with NVDA, JAWS, or VoiceOver
- Check ARIA attributes - Verify
aria-labelledbyandaria-describedbyreference correct IDs - Validate HTML - Ensure the generated SVG is valid
Next steps
Setup and configuration
Configure global and diagram-specific settings
Icons
Add icons to your diagrams