# st.mermaid_chart

Source: https://docs.streamlit.io/develop/api-reference/charts/st.mermaid_chart

* Function signature:

   ```python
   st.mermaid_chart(body, *, width="stretch", alt=None)
   ```

* Parameters:

   | name | type | default | description |
   |---|---|---|---|
   | 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:  "stretch" (default): The width of the element matches the width of the parent container. "content": The width of the element matches the width of its content, but doesn't exceed the width of the parent container. An integer specifying the width in pixels: The element has a fixed width. If the specified width is greater than the width of the parent container, the width of the element matches the width of the parent container. |
   | alt | str or None |  | A short, plain-text accessible name for the diagram. If this is None (default), the diagram keeps any Mermaid accTitle / accDescr directives in body, or falls back to a type-derived name such as "Mermaid flowchart". An empty or whitespace-only string is treated the same as None and is logged so authors notice the dual meaning of alt="" across commands (decorative only on st.image / st.pyplot). When alt is set, it replaces any accTitle or accDescr directives for the accessible name. Streamlit records the normalized one-line value in the diagram source as a Mermaid comment (%% stAlt: …, visible via Copy Source) so every diagram type keeps rendering. Describe what the diagram shows rather than repeating text that is already visible on the page. This is a short name, not a full text alternative for a dense diagram. |
