https://github.com/arunmichaeldsouza/react-image-appear
ReactJS component to make images appear with transition as they load.
https://github.com/arunmichaeldsouza/react-image-appear
css3-animations image-loader image-transition loader placeholder placeholder-background reactjs-component
Last synced: 3 months ago
JSON representation
ReactJS component to make images appear with transition as they load.
- Host: GitHub
- URL: https://github.com/arunmichaeldsouza/react-image-appear
- Owner: ArunMichaelDsouza
- License: mit
- Created: 2018-01-07T17:59:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T23:34:26.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T22:14:45.631Z (3 months ago)
- Topics: css3-animations, image-loader, image-transition, loader, placeholder, placeholder-background, reactjs-component
- Language: JavaScript
- Homepage:
- Size: 4.4 MB
- Stars: 277
- Watchers: 16
- Forks: 16
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# react-image-appear [](https://badge.fury.io/js/react-image-appear) [](https://www.npmjs.com/package/react-image-appear) [](https://travis-ci.org/ArunMichaelDsouza/react-image-appear)
ReactJS component to make images appear with transition as they load.
> Wraps an ``img`` within a placeholder element and adds a gif loader in between. No more ugly-looking progressively loading images!
This project has also been ported to AngularJS 1.x - [ng-image-appear](https://github.com/ArunMichaelDsouza/ng-image-appear).
## Installation
#### via npm
```bash
npm install react-image-appear --save
```#### via yarn
```bash
yarn add react-image-appear
```
## Usage
Import the component and provide the ``src`` with any of the available [props](#props).
```jsx
import ReactImageAppear from 'react-image-appear';```
## Props
#### ``src {string} | required``
The image source.```jsx
```
#### ``className {string}``
Classes to be applied to the image.```jsx
```
#### ``loader {string}``
Adds a custom loader to the component. When not provided, applies a default one.```jsx
```

#### ``loaderStyle {object}``
Adds custom styling to the loader.```jsx
```
#### ``loaderClass {string}``
Adds CSS classes to the loader.```jsx
```
#### ``placeholder {boolean | string}``
Adds a placeholder background to the component.```jsx
```

You can override the default placeholder background and add your own by passing an image URL to this prop.
```jsx
```

#### ``placeholderStyle {object}``
Adds custom styling to the placeholder.```jsx
```
#### ``placeholderClass {string}``
Adds CSS classes to the placeholder.```jsx
```
#### ``animation {string} | Default: fadeIn``
Add a CSS3 powered animation to the image as it appears.```jsx
```

react-image-appear has the following built-in CSS3 animations -
##### ``fadeIn (default)``
##### ``fadeInUp``
##### ``fadeInRight``
##### ``fadeInDown``
##### ``fadeInLeft``
##### ``bounceIn``
##### ``bounceInUp``
##### ``bounceInRight``
##### ``bounceInDown``
##### ``bounceInLeft``
##### ``flipInX``
##### ``flipInY``
##### ``zoomIn``
##### ``blurIn``
##### ``blurInUp``
##### ``blurInRight``
##### ``blurInDown``
##### ``blurInLeft``
##### ``fillIn``
#### ``animationDuration {string} | Default: 700ms``
Specifies the animation duration for the image to appear.
```jsx
```
#### ``easing {string} | Default: ease-in-out``
Specifies the timing-function for the CSS3 powered animation.
```jsx
```
#### ``showLoader {boolean} | Default: true``
Specifies whether to show the loader or not.```jsx
```

#### ``onClick {function}``
Callback to be called when the image is clicked.```jsx
```
## Testing
ReactImageAppear uses the [jest](https://facebook.github.io/jest/) test runner along with [enzyme](http://airbnb.io/enzyme/) for easier assertion and manipulation. Run the following command to start the jest test runner -
```bash
npm test
```
## Contributors
| [
Arun Michael Dsouza](https://github.com/ArunMichaelDsouza)
| [
Patrick](https://github.com/pcw0002)
| [
Stefan](https://github.com/stnwk)
| [
Tim Carr](https://github.com/xaphod)
|
| :---: | :---: | :---: | :---: |
## Support
If you'd like to help support the development of the project, please consider backing me on Patreon -
[
](https://www.patreon.com/bePatron?u=8841116)
## License
MIT Licensed
Copyright (c) 2018 Arun Michael Dsouza ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.