2.0.1 • Published 4 years ago
react-fitted-img v2.0.1
react-fitted-img
React component for fitting and positioning images with cross-browser support.
Usage
import FittedImg from 'react-fitted-img';
<FittedImg src="/path/to/image.png" alt="Thing" fit="cover" position="0 50%" />;Props
srcrequired URL of the image you want to embed (MDN)altoptional text description of the image (MDN)fitoptional sets how the image should be resized to fit its container. Supports the object-fit values:fill(default),contain,cover, andnone.heightoptional the intrinsic height of the image in pixels. (MDN)positionoptional the alignment of the image's contents within the element's box. Supports object-position values.widthoptional the intrinsic width of the image in pixels. (MDN)
:information_source: Additional props will be passed down.
Limitations
For browsers that don't support object-fit/object-position, the fallback doesn't support:
- Event handlers like
onErrorandonLoad. - Other image attributes, such as
crossorigin,loading,sizes,srcset,usemap, etc… - CSS background images.
2.0.1
4 years ago
2.0.0
5 years ago
1.7.0
5 years ago
1.6.0
5 years ago
1.5.0
5 years ago
1.4.0
5 years ago
1.3.2
5 years ago
1.3.0
5 years ago
1.2.0
5 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
7 years ago
1.0.3
8 years ago
1.0.2
8 years ago
1.0.1
8 years ago
1.0.0
8 years ago
0.0.4
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.1
9 years ago