🌠 Async loading, performant Image component for React.js
See the code
A powerful, customisable, Suspense-like
<img>component that (optionally) simulates a shimmer effect while loading. (with zero dependencies!).

npm i react-shimmer
or
yarn add react-shimmer
import React from 'react'
import { Image, Shimmer } from 'react-shimmer'
function App() {
return (
<div>
<Image
src='https://source.unsplash.com/random/800x600'
fallback={<Shimmer width={800} height={600} />}
/>
</div>
)
}
import React from 'react'
import { Image, Breathing } from 'react-shimmer'
function App() {
return (
<div>
<Image
src='https://source.unsplash.com/random/800x600'
fallback={<Breathing width={800} height={600} />}
/>
</div>
)
}
or you can use your custom React component as a fallback:
import React from 'react'
import { Image } from 'react-shimmer'
import Spinner from './Spinner'
function App(props) {
return (
<div>
<Image
src="https://example.com/test.jpg"
fallback={<Spinner />}
/>
</div>
)
}
| Property | Type | Required | Default value | Description |
|---|---|---|---|---|
src | string | yes | ||
fallback | ReactNode | yes | ||
errorFallback | func | no | ||
onLoad | func | no | ||
delay | number | no | Delay in milliseconds before showing the fallback | |
fadeIn | bool | no | false | Use built-in fade animation on img |
NativeImgProps | React.ImgHTMLAttributes | no |
Feel free to send PRs.
MIT © gokcan
Overall
Maintained
Code review
Latest release
Releases this year
45 followers · starred Jul 2018
225 followers · starred May 2020
1,232 followers · starred Jul 2018
566 followers · starred Jul 2018
🌠 Async loading, performant Image component for React.js
See the code
A powerful, customisable, Suspense-like
<img>component that (optionally) simulates a shimmer effect while loading. (with zero dependencies!).

npm i react-shimmer
or
yarn add react-shimmer
import React from 'react'
import { Image, Shimmer } from 'react-shimmer'
function App() {
return (
<div>
<Image
src='https://source.unsplash.com/random/800x600'
fallback={<Shimmer width={800} height={600} />}
/>
</div>
)
}
import React from 'react'
import { Image, Breathing } from 'react-shimmer'
function App() {
return (
<div>
<Image
src='https://source.unsplash.com/random/800x600'
fallback={<Breathing width={800} height={600} />}
/>
</div>
)
}
or you can use your custom React component as a fallback:
import React from 'react'
import { Image } from 'react-shimmer'
import Spinner from './Spinner'
function App(props) {
return (
<div>
<Image
src="https://example.com/test.jpg"
fallback={<Spinner />}
/>
</div>
)
}
| Property | Type | Required | Default value | Description |
|---|---|---|---|---|
src | string | yes | ||
fallback | ReactNode | yes | ||
errorFallback | func | no | ||
onLoad | func | no | ||
delay | number | no | Delay in milliseconds before showing the fallback | |
fadeIn | bool | no | false | Use built-in fade animation on img |
NativeImgProps | React.ImgHTMLAttributes | no |
Feel free to send PRs.
MIT © gokcan
Overall
Maintained
Code review
Latest release
Releases this year
45 followers · starred Jul 2018
225 followers · starred May 2020
1,232 followers · starred Jul 2018
566 followers · starred Jul 2018