
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
react-shimmer-skeleton
Advanced tools
A react library for generating custom skeleton loading components automatically
A react library for generating custom skeleton loading components automatically
You can install it using npm:
npm install react-shimmer-skeleton
or yarn:
yarn add react-shimmer-skeleton
Just pass the component you want to load as a children to the Skeleton component.
If the children is receiving any props, you should also pass to the Skeleton component a
component prop, which is the function of the children component
and an exampleProps prop, which is an object with the same props that your component receives,
that will be used to determine, for example, the length of the texts.
Here is a basic example:
import Skeleton from 'react-shimmer-skeleton'
import {UserCard} from '../Components/UserCard'
//This mimics a delay from the api
const [isLoading, setIsLoading] = useState(true)
useEffect(()=>{
setTimeout(()=>{
setIsLoading(false)
},2000)
},[])
//imagine this data is coming from an api
const user = {
name: 'Filipe Pfluck',
avatar: 'https://avatars.githubusercontent.com/u/62773200?v=4',
description: 'Fullstack developer focused in typescript.'
}
//Now let's create an example user:
const fakeUser = {
name: 'Joe Doe',
avatar: 'https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460__340.png',
description: 'Lorem ipsum dolor sit, amet consectetur adipisicing elit.'
}
...
return(
<Skeleton
isLoading={isLoading}
component={UserCard}
exampleProps={{user: fakeUser}}
>
<UserCard user={user}/>
</Skeleton>
)

The skeleton component accepts the following props:
If you want to change the background, it is done through the background-image property. This is the default background:
background-image: linear-gradient(
-90deg,
#28262E 0%,
#605e67 50%,
#28262E 100%
);
background-size: 400% 400%;
You can change it passing defaultStyles, className, or even styling it other way, such as using styled-components
For now, while the component is loading, the library creates a copy of your component using the function received through the component property and using the exampleProps, but keeping it invisible. When it is not loading anymore, it is substituted with the actual component, that comes trough the children. Keep in mind that if the component you're loading makes any requests, it will be done twice. Also, it is not recomended to set the isLoading prop to true if you're refatching the data, because any state of your component will be reseted. I know this is a issue, so I'm trying to come up with a better solution. For now, this lib is best suited for interface only components, that receives all the data they need through props.
FAQs
A react library for generating custom skeleton loading components automatically
We found that react-shimmer-skeleton 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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.