Skip to content

Conversation

Samii2383
Copy link

Updates MediaCard.tsx and ImgMediaCard.tsx to make media responsive:
Use component="img" with sx={{ width: '100%', height: 'auto', aspectRatio: '16 / 9' }} to prevent overflow on small screens.
Add loading="lazy" and proper alt casing.
Scope: docs examples only; no package code changed.

…g fluid media sizing (aspect-ratio, width 100%, lazy-loading)
@Samii2383
Copy link
Author

Hi! This is a docs-only improvement to two Card demos to behave better on small screens.
Switches CardMedia to fluid sizing with sx={{ width: '100%', height: 'auto', aspectRatio: '16 / 9' }} and adds loading="lazy".
Prevents image overflow in mobile layouts while keeping the demo visually consistent.
Scope: examples only; no package code touched, no changeset needed.
Happy to adjust the aspect ratio or use another recommended pattern (e.g., objectFit: 'cover') if you prefer.

@mui-bot
Copy link

mui-bot commented Oct 16, 2025

Netlify deploy preview

https://deploy-preview-47078--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against a87cfa3

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use component="img" with sx={{ width: '100%', height: 'auto', aspectRatio: '16 / 9' }} to prevent overflow on small screens.

@Samii2383 Can you give a reproduction perhaps in the form of screenshots or a screen recording where it overflows on small screens?

@zannager zannager added docs Improvements or additions to the documentation. scope: card Changes related to the card. labels Oct 17, 2025
@ZeeshanTamboli ZeeshanTamboli changed the title docs(cards): improve responsiveness in MediaCard/ImgMediaCard demo [docs][card]: improve responsiveness in MediaCard/ImgMediaCard demo Oct 17, 2025
@ZeeshanTamboli ZeeshanTamboli changed the title [docs][card]: improve responsiveness in MediaCard/ImgMediaCard demo [docs][card] Improve responsiveness in MediaCard/ImgMediaCard demo Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. scope: card Changes related to the card.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants