Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gokcan/react-shimmer

🌠 Async loading, performant Image component for React.js
https://github.com/gokcan/react-shimmer

async loader placeholder react react-image react-suspense shimmer

Last synced: about 1 month ago
JSON representation

🌠 Async loading, performant Image component for React.js

Awesome Lists containing this project

README

        


Logo

> A powerful, customisable, Suspense-like `` component that (optionally) simulates a [**shimmer**](https://github.com/facebook/Shimmer) effect while __loading__. (with zero dependencies!).



NPM


JavaScript Style Guide


Github Actions CI Status


Maintainability


Header

### [__Live Demo__](https://codesandbox.io/s/nh9x1)

![](https://cdn.rawgit.com/gokcan/react-shimmer/master/media/demo.gif)

## Install

```bash
npm i react-shimmer
```

or

```bash
yarn add react-shimmer
```

## Usage

```jsx
import React from 'react'
import { Image, Shimmer } from 'react-shimmer'

function App() {
return (


}
/>

)
}
```

```jsx
import React from 'react'
import { Image, Breathing } from 'react-shimmer'

function App() {
return (


}
/>

)
}
```

or you can use your custom React component as a fallback:

```jsx
import React from 'react'
import { Image } from 'react-shimmer'

import Spinner from './Spinner'

function App(props) {
return (


}
/>

)
}
```

### Properties

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||
-----

## Contributing
---

Feel free to send PRs.

## License

MIT © [gokcan](https://github.com/gokcan)