import * as React from 'react'; import { Image, IImageProps, ImageFit } from '@fluentui/react/lib/Image'; // These props are defined up here so they can easily be applied to multiple Images. // Normally specifying them inline would be fine. const imageProps: IImageProps = { imageFit: ImageFit.center, width: 350, height: 150, // Show a border around the image (just for demonstration purposes) styles: props => ({ root: { border: '1px solid ' + props.theme.palette.neutralSecondary } }), }; export const ImageCenterExample = () => { return (
Setting the imageFit property to ImageFit.center behaves the same as{' '}
ImageFit.none, while centering the image within the frame.
This image is larger than the frame, so all sides are cropped to center the image.
This image is smaller than the frame, so there is empty space within the frame. The image is centered in the available space.