SuperImage
React component that render a image with object-fit
and its fallback
Install
$ npm install --save super-image
This package use Object.assign()
, so you may need to polyfill via object.assign
.
Usage
<SuperImage
src="image.png"
width="160"
height="90"
alt="super-image"
fit="contain"
/>
<SuperImage
fitFallback
src="image.png"
width="160"
height="90"
alt="super-image"
fit="contain"
/>
Config
Property | Type | Description | Default value | Required |
---|
src | String | Image url | - | Yes |
width | DOMString | Image width | - | No |
height | DOMString | Image height | - | No |
alt | String | Alternate text for image | "" | No |
className | String | Custom className | "" | No |
flexible | Boolean | If this is true, A Component size is not fixed. | false | No |
fit | String | Value of the object-fit property. "contain", or "cover" | - | No |
fitFallback | Boolean | Force the component to use background-image | false | No |
License
MIT © FRESH!