No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

Image

An image displays graphical content such as a photo or illustration.

Best Practices

Do

  • Provide descriptive, accurate and concise description for alt attribute in order to be accessible to screen readers.

  • The alt description should also include and consider the context where the image fits in.

  • Decorative images should be excluded for assistive tools, thus adding role="presentation" or aria-hidden="true".

Don't

  • Don't include "image of", "picture of" etc. in the alt attribute since it is redundant.

  • Don't repeat the same information that is already on the page on the alt attribute.


Default

NameDescriptionDefaultControl
bordered
An image can appear with rectangular border.
boolean
-
fit
An image can set how it should be resized to fit its container.
"center""none""contain""cover"
-
block
An image can take up the width of its container.
boolean
-
shape
An image can appear square, circular, or rounded.
"circular""square""rounded"
-
shadow
An image can appear elevated with shadow.
boolean
-
alt
description of the image, which isn't mandatory but is incredibly useful for accessibility
-
src
path to the image you want to display
-

Stories

Shape

Images can be styled as square (default), circular, or with rounded corners.

Bordered

The bordered prop will apply a border style to images regardless of its shape.

Fallback

In cases when images fail to load, the Image component will result into the native <img/> browser fallback.

Block

An Image can be maximized in order to fill its parent container.

Fit

The fit prop is used to determine how the image should be resized in order to fit its container.

The image can be resized in various ways: centering to its container(center), filling its container (cover) or preserving the aspect ratio (contain).

None


Center


Contain



Cover



Open in CodeSandbox

Shadow

The shadow prop will apply box shadow styling to the image.