Gathering detailed insights and metrics for react-loading-skeleton
Gathering detailed insights and metrics for react-loading-skeleton
Gathering detailed insights and metrics for react-loading-skeleton
Gathering detailed insights and metrics for react-loading-skeleton
react-content-loader
SVG-Powered component to easily create placeholder loadings (like Facebook cards loading)
@chakra-ui/skeleton
React component to render a placeholders while you wait for content to load
react-native-skeleton-placeholder
SkeletonPlaceholder is a React Native library to easily create an amazing loading effect.
skeleton-elements
Skeleton elements (aka UI Skeletons, Skeleton Screens, Ghost Elements) - UI for improved perceived performance
Create skeleton screens that automatically adapt to your app!
npm install react-loading-skeleton
Typescript
Module System
Node Version
NPM Version
TypeScript (89.05%)
JavaScript (10.43%)
CSS (0.36%)
Shell (0.16%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
4,142 Stars
249 Commits
159 Forks
21 Watchers
11 Branches
22 Contributors
Updated on Jul 10, 2025
Latest Version
3.5.0
Package Id
react-loading-skeleton@3.5.0
Unpacked Size
26.09 kB
Size
7.45 kB
File Count
11
NPM Version
10.8.2
Node Version
22.7.0
Published on
Sep 21, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
42
Make beautiful, animated loading skeletons that automatically adapt to your app.
Learn about the changes in version 3, or view the v2 documentation.
Install via one of:
1yarn add react-loading-skeleton 2npm install react-loading-skeleton
1import Skeleton from 'react-loading-skeleton' 2import 'react-loading-skeleton/dist/skeleton.css' 3 4<Skeleton /> // Simple, single-line loading skeleton 5<Skeleton count={5} /> // Five-line loading skeleton
The Skeleton
component should be used directly in your components in place of
content that is loading. While other libraries require you to meticulously craft
a skeleton screen that matches the font size, line height, and margins of your
content, the Skeleton
component is automatically sized to the correct
dimensions.
For example:
1function BlogPost(props) { 2 return ( 3 <div> 4 <h1>{props.title || <Skeleton />}</h1> 5 {props.body || <Skeleton count={10} />} 6 </div> 7 ); 8}
...will produce correctly-sized skeletons for the heading and body without any further configuration.
This ensures the loading state remains up-to-date with any changes to your layout or typography.
Instead, make components with built-in skeleton states.
This approach is beneficial because:
Customize individual skeletons with props, or render a SkeletonTheme
to style
all skeletons below it in the React hierarchy:
1import Skeleton, { SkeletonTheme } from 'react-loading-skeleton'; 2 3return ( 4 <SkeletonTheme baseColor="#202020" highlightColor="#444"> 5 <p> 6 <Skeleton count={3} /> 7 </p> 8 </SkeletonTheme> 9);
Skeleton
onlyProp | Description | Default |
---|---|---|
count?: number |
The number of lines of skeletons to render. If
count is a decimal number like 3.5,
three full skeletons and one half-width skeleton will be
rendered.
| 1 |
wrapper?: React.FunctionComponent | A custom wrapper component that goes around the individual skeleton elements. | |
circle?: boolean |
Makes the skeleton circular by setting border-radius to
50% .
| false |
className?: string |
A custom class name for the individual skeleton elements which is used
alongside the default class, react-loading-skeleton .
| |
containerClassName?: string |
A custom class name for the <span> that wraps the
individual skeleton elements.
| |
containerTestId?: string |
A string that is added to the container element as a
data-testid attribute. Use it with
screen.getByTestId('...') from React Testing Library.
| |
style?: React.CSSProperties |
This is an escape hatch for advanced use cases and is not the preferred
way to style the skeleton. Props (e.g. width ,
borderRadius ) take priority over this style object.
|
Skeleton
and SkeletonTheme
Prop | Description | Default |
---|---|---|
baseColor?: string | The background color of the skeleton. | #ebebeb |
highlightColor?: string | The highlight color in the skeleton animation. | #f5f5f5 |
width?: string | number | The width of the skeleton. | 100% |
height?: string | number | The height of each skeleton line. | The font size |
borderRadius?: string | number | The border radius of the skeleton. | 0.25rem |
inline?: boolean |
By default, a <br /> is inserted after each skeleton so
that each skeleton gets its own line. When inline is true, no
line breaks are inserted.
| false |
duration?: number | The length of the animation in seconds. | 1.5 |
direction?: 'ltr' | 'rtl' | The direction of the animation, either left-to-right or right-to-left. | 'ltr' |
enableAnimation?: boolean |
Whether the animation should play. The skeleton will be a solid color when
this is false . You could use this prop to stop the animation
if an error occurs.
| true |
customHighlightBackground?: string |
Allows you to override the background-image property of the highlight element, enabling you to fully customize the gradient. See example below.
| undefined |
There are two ways to wrap a skeleton in a container:
1function Box({ children }: PropsWithChildren<unknown>) { 2 return ( 3 <div 4 style={{ 5 border: '1px solid #ccc', 6 display: 'block', 7 lineHeight: 2, 8 padding: '1rem', 9 marginBottom: '0.5rem', 10 width: 100, 11 }} 12 > 13 {children} 14 </div> 15 ); 16} 17 18// Method 1: Use the wrapper prop 19const wrapped1 = <Skeleton wrapper={Box} count={5} />; 20 21// Method 2: Do it "the normal way" 22const wrapped2 = ( 23 <Box> 24 <Skeleton /> 25 </Box> 26);
You may want to make the gradient used in the highlight element narrower or wider. To do this, you can set the customHighlightBackground
prop. Here's an example of a narrow highlight:
1<Skeleton customHighlightBackground="linear-gradient(90deg, var(--base-color) 40%, var(--highlight-color) 50%, var(--base-color) 60%)" />
If you use this prop, the baseColor
and highlightColor
props are ignored, but you can still reference their corresponding CSS variables as shown in the above example.
display: flex
!In the example below, the width of the skeleton will be 0:
1<div style={{ display: 'flex' }}> 2 <Skeleton /> 3</div>
This happens because the skeleton has no intrinsic width. You can fix it by
applying flex: 1
to the skeleton container via the containerClassName
prop.
For example, if you are using Tailwind, your code would look like this:
1<div style={{ display: 'flex' }}> 2 <Skeleton containerClassName="flex-1" /> 3</div>
In the example below, the height of the <div>
will be slightly larger than 30
even though the react-loading-skeleton
element is exactly 30px.
1<div> 2 <Skeleton height={30} /> 3</div>
This is a consequence of how line-height
works in CSS. If you need the <div>
to be exactly 30px tall, set its line-height
to 1. See
here
for more details.
Contributions are welcome! See CONTRIBUTING.md
to get started.
Our logo is based off an image from Font Awesome. Thanks!
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 9/22 approved changesets -- score normalized to 4
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
47 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More