-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Image component #22470
Comments
https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image |
@michael-land It reminds me of one of the reasons why we didn't call
As long as you have eslint or TypeScript, it should be fine: Otherwise, it's a nightmare: The other reason we have kept Typography was to match the theme.typography structure. But we could also argue that using two different names would reduce confusion when searching on Google 🤔. Next.js went with Image: https://nextjs.org/docs/app/api-reference/components/image |
I don't think we can implement meaningful features since the most important ones rely on the build setup. A meta framework is far better suited to host such a component. There's a RFC in nextjs which has far better research and highlights why this component should leverage the build setup: vercel/next.js#16832 |
The only feature that we can meaningful implement is responsiveness considering we have breakpoints in the theme. All the other features are better suited for meta-frameworks. |
Which comes with a drawback: portability. What works in Next.js doesn't in Gatsby or CRA. |
Would this bring support for |
Can I use the element inside the component to have the image as a background image? Such as: <Image src="xxx">
<div />
</Image> |
@oliviertassinari @eps1lon In my team we had the need to have an Here is a Codesandbox with a POC that I built, maybe it can be used in something for the construction of this much desired component and start working on it (: Features:
https://codesandbox.io/s/material-ui-image-8icbi?file=/src/App.js |
This comment was marked as resolved.
This comment was marked as resolved.
I think the solution to this issue is to bring AspectRatio component to Material UI. As a UI library, it makes more sense to provide a component that helps control the layout and leave |
@siriwatknp, that makes sense. Which of the description's motivation features could we cover with the |
@DiegoAndai I should not have used the word My point is that we should leave the Image component to meta frameworks and provide a layout component (AspectRatio) as a companion. So, I think this issue should be closed, and another one should be created for adding AspectRatio to Material UI. |
@siriwatknp Agree. Would you open a new issue for adding the AspectRatio and close this one when that's done? |
Summary 💡
Implement an enhanced version of the native
<img>
element.Examples 🌈
Motivation 🔦
A couple of features we could bring:
display: inline-block;
to avoid layout jumps when the image is loading or broken.Benchmark
The text was updated successfully, but these errors were encountered: