st.mermaid_chart
Display a Mermaid diagram.
Mermaid is a diagramming and charting tool that uses text-based definitions to create diagrams dynamically. For more information about Mermaid syntax, see https://mermaid.js.org/.
| Function signature[source] | |
|---|---|
st.mermaid_chart(body, *, width="stretch") | |
| Parameters | |
body (str) | The Mermaid diagram definition as a string. This uses Mermaid's text-based syntax to define flowcharts, sequence diagrams, class diagrams, state diagrams, and more. |
width ("stretch", "content", or int) | The width of the element. This can be one of the following:
|
Examples
import streamlit as st st.mermaid_chart(''' graph LR A[Start] --> B{Decision} B -->|Yes| C[OK] B -->|No| D[Cancel] ''')
Still have questions?
Our forums are full of helpful information and Streamlit experts.