office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
1 lines • 1.15 kB
JavaScript
define([], function() { return "import * as React from 'react';\r\nimport {\r\n Image,\r\n IImageProps,\r\n ImageFit,\r\n Label\r\n} from '../../../../index';\r\n\r\nexport class ImageCenterExample extends React.Component<any, any> {\r\n public render() {\r\n let imageProps: IImageProps = {\r\n src: 'http://placehold.it/800x300',\r\n imageFit: ImageFit.center,\r\n width: 350,\r\n height: 150,\r\n onLoad: (ev) => console.log('image loaded', ev)\r\n };\r\n\r\n return (\r\n <div>\r\n <p>Setting the imageFit property to \"center\" behaves the same as \"none\", while centering the image within the frame.</p>\r\n <Label>The image is larger than the frame, so all sides are cropped to center the image.</Label>\r\n <Image { ...imageProps as any } src='http://placehold.it/800x300' />\r\n <br />\r\n <Label>The image is smaller than the frame, so there is empty space within the frame. The image is centered in the available space.</Label>\r\n <Image { ...imageProps as any } src='http://placehold.it/100x100' />\r\n </div>\r\n );\r\n }\r\n}\r\n"; });