Skip to content

fix(streamdown): improve mermaid diagram sizing and responsiveness#471

Open
ayhansipahi wants to merge 1 commit intovercel:mainfrom
ayhansipahi:fix/mermaid-sizing
Open

fix(streamdown): improve mermaid diagram sizing and responsiveness#471
ayhansipahi wants to merge 1 commit intovercel:mainfrom
ayhansipahi:fix/mermaid-sizing

Conversation

@ayhansipahi
Copy link
Contributor

Description

Mermaid SVG diagrams could overflow their container, especially on smaller viewports. This PR constrains diagrams to their container width and improves layout consistency.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Related Issues

Changes Made

  • Constrain mermaid SVG diagrams to container width using max-w-full, h-auto, and w-full CSS classes
  • Add min-w-0 to chart container for proper flexbox shrinking
  • Increase minimum container height from min-h-28 to min-h-48 for better initial layout
  • Align non-fullscreen diagrams to items-start instead of no alignment

Testing

  • All existing tests pass
  • Added new tests for the changes
  • Manually tested the changes

Test Coverage

Added 2 new tests:

  • should apply responsive sizing classes to chart container — verifies w-full, min-w-0, items-start in normal mode
  • should apply fullscreen alignment to chart container — verifies items-center, size-full in fullscreen mode

All 17 mermaid component tests pass.

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have created a changeset (pnpm changeset)

Changeset

  • I have created a changeset for these changes

Constrain SVG diagrams to container width with max-w-full and h-auto,
increase minimum container height, and align items to start in non-fullscreen mode.
@vercel
Copy link
Contributor

vercel bot commented Mar 18, 2026

@ayhansipahi is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant