ImagePreview API
API reference docs for the React ImagePreview component. Learn about the props and other APIs of this exported module.
Apart from the props described bellow, the
ImagePreview
component accepts all the HTML <img/>
default props. You can check them out here.Demo
Props
Name | Type | Default | Description |
---|---|---|---|
src | string | File | Image source in string format (URL) or File Object (Will be read as URL). | |
width | string | The width of the image. | |
height | string | The height of the image. | |
alt | string | Alternative label when an error occurs on loading the image | |
onError | func | Callback fired when an error occured on loading the image. | |
smartImgFit | false | "orientation" | "center" | "orientation" | If false, image width will be set to 100%. If present, image will be analized and displayed according to its heigh and width. Image with height greater than its width has a "portrait" orientation. Otherwise it has a "landscape" orientation. .
|
style | React.CSSProperties | The in-line style object. | |
className | string | The classname to override the css styles in .css or .sass file instead of using in-line styles. |