
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
react-shimmer
Advanced tools
React Image (Suspense-like) Loader component that simulates a shimmer effect
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
FAQs
React Image (Suspense-like) Loader component that simulates a shimmer effect
The npm package react-shimmer receives a total of 3,969 weekly downloads. As such, react-shimmer popularity was classified as popular.
We found that react-shimmer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.