Skip to content

Add Image component #22470

@oliviertassinari

Description

@oliviertassinari
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

Implement an enhanced version of the native <img> element.

Examples 🌈

import { Image } from '@material-ui/core';

<Image src="" />

Motivation 🔦

A couple of features we could bring:

  1. Use display: inline-block; to avoid layout jumps when the image is loading or broken.
  2. Provide a custom fallback component when the image fails to load.
  3. Support a loading indicator when the image takes too much time to load, e.g Skeleton.
  4. Add a smooth animation for displaying the image once loaded.
  5. Support a placeholder to display while image's loading. An image of lower resolution.
  6. Lazy loading? Maybe not relevant considering https://caniuse.com/#feat=loading-lazy-attr and https://web.dev/native-lazy-loading/.
  7. Support aspect ratio. For instance, it allows rendering an image with a width constraint without having to wait for the image to load over the networks to resolve its height (which might lead to a layout shift).

Benchmark

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: new proposalProposal to increase the product scope covered.type: new featureExpand the scope of the product to solve a new problem.waiting for 👍Waiting for upvotes. Open for community feedback and needs more interest to be worked on.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions