react-content-loader vs react-spinners vs react-loader-spinner vs react-loading vs react-spinkit vs react-loader
React Loading Indicators Comparison
1 Year
react-content-loaderreact-spinnersreact-loader-spinnerreact-loadingreact-spinkitreact-loaderSimilar Packages:
What's React Loading Indicators?

Loading indicators are essential UI components that enhance user experience by providing visual feedback during asynchronous operations. They inform users that a process is ongoing, helping to prevent confusion and frustration. Each of these libraries offers unique styles and functionalities for implementing loading animations in React applications, allowing developers to choose based on their design requirements and performance considerations.

Package Weekly Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
react-content-loader673,89513,892162 kB1810 months agoMIT
react-spinners482,8993,204541 kB1516 hours agoMIT
react-loader-spinner238,907-7.31 MB-a year agoMIT
react-loading62,253814-207 years agoMIT
react-spinkit34,3521,494-488 years agoMIT
react-loader10,492---5 years agoMIT
Feature Comparison: react-content-loader vs react-spinners vs react-loader-spinner vs react-loading vs react-spinkit vs react-loader

Customization Options

  • react-content-loader:

    react-content-loader allows extensive customization of the skeleton loading screens, enabling developers to define shapes, sizes, and colors that match their application's design. This flexibility helps maintain a consistent user interface while providing a loading experience that feels integrated.

  • react-spinners:

    react-spinners is highly customizable, allowing developers to modify colors, sizes, and animation speeds. This level of customization ensures that loading indicators can be tailored to match the overall design language of the application.

  • react-loader-spinner:

    react-loader-spinner provides several pre-defined spinner styles that can be easily customized in terms of size and color. This makes it a good choice for developers who want visually appealing spinners without the need for extensive design work.

  • react-loading:

    react-loading supports multiple loader types and allows for customization of size and color. This versatility makes it easy to adapt loaders to fit different UI themes, providing a balance between functionality and design.

  • react-spinkit:

    react-spinkit offers a variety of CSS spinners that can be styled using CSS properties. While it provides a set of predefined styles, developers can easily adjust colors and sizes to fit their application's aesthetics.

  • react-loader:

    react-loader offers limited customization options, focusing on simplicity. It provides basic loading indicators without extensive styling capabilities, making it suitable for projects that prioritize minimalism over design flexibility.

Animation Types

  • react-content-loader:

    react-content-loader focuses on skeleton loading animations, which simulate the layout of the content being loaded. This approach is effective in improving perceived performance and user engagement during loading times.

  • react-spinners:

    react-spinners provides a rich selection of loading animations, including circular, bouncing, and fading spinners. This extensive collection allows for creative freedom in designing loading experiences that enhance user engagement.

  • react-loader-spinner:

    react-loader-spinner offers a diverse range of animated spinners, including circular, linear, and other creative designs. This variety allows developers to choose animations that best fit their application's style and user experience.

  • react-loading:

    react-loading supports multiple animation types, including spinners and bars, giving developers the flexibility to choose the most appropriate loader for their use case. This adaptability is beneficial for applications with varying loading scenarios.

  • react-spinkit:

    react-spinkit features a collection of CSS spinners that include various animation styles, such as bouncing, rotating, and fading. This variety allows developers to select animations that align with the desired user experience and aesthetic.

  • react-loader:

    react-loader provides basic loading animations, primarily in the form of simple spinners or bars. Its straightforward animations are suitable for applications that require quick and clear loading feedback without complexity.

Performance

  • react-content-loader:

    react-content-loader is optimized for performance, as it only renders the skeleton screens when necessary, minimizing the impact on the overall application performance. This efficiency is crucial for applications with complex UIs or heavy content loading.

  • react-spinners:

    react-spinners is optimized for performance, ensuring that the loading animations run smoothly without causing lag or delays in the application. This is particularly important for applications with dynamic content.

  • react-loader-spinner:

    react-loader-spinner is designed to be efficient, with animations that do not heavily tax the browser's rendering capabilities. This ensures smooth performance even when multiple loaders are used simultaneously.

  • react-loading:

    react-loading is efficient in rendering various loader types without compromising performance. Its design allows for quick loading feedback while maintaining a responsive user interface.

  • react-spinkit:

    react-spinkit is built with performance in mind, utilizing CSS animations that are lightweight and do not hinder the performance of the application. This makes it a good choice for applications that prioritize speed and responsiveness.

  • react-loader:

    react-loader is lightweight and has minimal performance overhead, making it suitable for applications that require quick loading feedback without significant resource consumption.

Ease of Use

  • react-content-loader:

    react-content-loader is user-friendly, with a straightforward API that allows developers to quickly implement skeleton loaders without extensive setup. This ease of use is beneficial for rapid development cycles.

  • react-spinners:

    react-spinners provides a user-friendly API that simplifies the process of adding loading animations to applications. This ease of use is particularly valuable for developers who want to enhance user experience quickly.

  • react-loader-spinner:

    react-loader-spinner is designed for quick integration, providing a simple API that allows developers to easily add spinners to their applications. This ease of use is advantageous for projects with tight deadlines.

  • react-loading:

    react-loading offers a simple interface for implementing various loaders, making it accessible for developers of all skill levels. Its straightforward approach facilitates quick adoption in projects.

  • react-spinkit:

    react-spinkit is easy to use, with a simple API that allows developers to quickly add CSS spinners to their applications. This ease of use is beneficial for developers who want to implement loading indicators without extensive configuration.

  • react-loader:

    react-loader is very easy to integrate, requiring minimal configuration. Its simplicity makes it ideal for developers looking for a quick solution to add loading indicators without complexity.

Community and Support

  • react-content-loader:

    react-content-loader has a growing community, with active contributions and support available through GitHub. This community involvement ensures that developers can find help and resources when needed.

  • react-spinners:

    react-spinners boasts a robust community with extensive documentation and resources available. This strong support network is beneficial for developers seeking assistance or inspiration for their projects.

  • react-loader-spinner:

    react-loader-spinner benefits from a supportive community, with resources available for troubleshooting and implementation. This community engagement helps developers effectively use the package.

  • react-loading:

    react-loading has a moderate community presence, providing some resources and support for developers. While not as extensive as others, it still offers enough guidance for effective use.

  • react-spinkit:

    react-spinkit has a decent community, with resources available for implementation and customization. This support can be helpful for developers looking to integrate CSS spinners into their applications.

  • react-loader:

    react-loader has a smaller community, which may limit the availability of resources and support. However, its simplicity means that most developers can easily implement it without needing extensive guidance.

How to Choose: react-content-loader vs react-spinners vs react-loader-spinner vs react-loading vs react-spinkit vs react-loader
  • react-content-loader:

    Opt for react-content-loader if you want to create custom skeleton screens that mimic the layout of your content while loading. It's great for improving perceived performance by showing placeholders that resemble the final content.

  • react-spinners:

    Choose react-spinners for a rich set of loading animations that are easy to customize. This library offers a variety of spinner types and sizes, allowing for a more tailored loading experience that can fit seamlessly into your application's design.

  • react-loader-spinner:

    Select react-loader-spinner if you need a variety of animated loading spinners. This package offers a range of pre-built spinner designs, making it easy to integrate visually appealing loading indicators into your application.

  • react-loading:

    Use react-loading when you want a flexible and customizable loading component that supports different types of loaders. It allows you to easily switch between various loader styles and sizes, catering to diverse design needs.

  • react-spinkit:

    Pick react-spinkit if you prefer a collection of CSS spinners that are easy to use and integrate. It provides a simple API and a variety of spinner styles, making it suitable for quick implementations without heavy customization.

  • react-loader:

    Choose react-loader for a simple, lightweight solution that provides basic loading indicators. It's ideal for projects that require minimal dependencies and straightforward loading feedback without extensive customization.

README for react-content-loader

react-content-loader

Example's react-content-loader

SVG-Powered component to easily create placeholder loadings (like Facebook's cards loading).

Features

  • :gear: Customizable: Feel free to change the colors, speed, sizes, and even RTL;
  • :ok_hand: Plug and play: with many presets to use, see the examples;
  • :pencil2: DIY: use the create-content-loader to create your own custom loaders easily;
  • 📱 React Native support: same API, as same powerful features;
  • ⚛️ Really lightweight: less than 2kB and 0 dependencies for web version;

Index

Getting Started

npm i react-content-loader --save
yarn add react-content-loader

For React Native

npm i react-content-loader react-native-svg --save
yarn add react-content-loader react-native-svg

CDN from JSDELIVR

Usage

There are two ways to use it:

1. Presets, see the examples:

import ContentLoader, { Facebook } from 'react-content-loader'

const MyLoader = () => <ContentLoader />
const MyFacebookLoader = () => <Facebook />

2. Custom mode, see the online tool

const MyLoader = () => (
  <ContentLoader viewBox="0 0 380 70">
    {/* Only SVG shapes */}    
    <rect x="0" y="0" rx="5" ry="5" width="70" height="70" />
    <rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
    <rect x="80" y="40" rx="3" ry="3" width="250" height="10" />
  </ContentLoader>
)

Still not clear? Take a look at this working example at codesandbox.io Or try the components editable demo hands-on and install it from bit.dev

Native

react-content-loader can be used with React Native in the same way as web version with the same import:

1. Presets, see the examples:

import ContentLoader, { Facebook } from 'react-content-loader/native'

const MyLoader = () => <ContentLoader />
const MyFacebookLoader = () => <Facebook />

2. Custom mode

To create custom loaders there is an important difference: as React Native doesn't have any native module for SVG components, it's necessary to import the shapes from react-native-svg or use the named export Rect and Circle from react-content-loader import:

import ContentLoader, { Rect, Circle } from 'react-content-loader/native'

const MyLoader = () => (
  <ContentLoader viewBox="0 0 380 70">
    <Circle cx="30" cy="30" r="30" />
    <Rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
    <Rect x="80" y="40" rx="3" ry="3" width="250" height="10" />
  </ContentLoader>
)

Options

|

Prop name and type
| Environment | Description | | ---------------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | animate?: boolean
Defaults to true | React DOM
React Native | Opt-out of animations with false | | title?: string
Defaults to Loading... | React DOM only | It's used to describe what element it is. 
Use '' (empty string) to remove. | | baseUrl?: string
Defaults to an empty string | React DOM only | Required if you're using <base url="/" /> document <head/>
This prop is common used as: 
<ContentLoader baseUrl={window.location.pathname} /> which will fill the SVG attribute with the relative path. Related #93. | | speed?: number
Defaults to 1.2 | React DOM
React Native | Animation speed in seconds. | | viewBox?: string
Defaults to undefined | React DOM
React Native | Use viewBox props to set a custom viewBox value,
for more information about how to use it,
read the article How to Scale SVG. | | gradientRatio?: number
Defaults to 1.2 | React DOM only | Width of the animated gradient as a fraction of the view box width. | | rtl?: boolean
Defaults to false | React DOM
React Native | Content right-to-left. | | backgroundColor?: string
Defaults to #f5f6f7 | React DOM
React Native | Used as background of animation. | | foregroundColor?: string
Defaults to #eee | React DOM
React Native | Used as the foreground of animation. | | backgroundOpacity?: number
Defaults to 1 | React DOM only | Background opacity (0 = transparent, 1 = opaque)
used to solve an issue in Safari | | foregroundOpacity?: number
Defaults to 1 | React DOM only | Animation opacity (0 = transparent, 1 = opaque)
used to solve an issue in Safari | | style?: React.CSSProperties
Defaults to {} | React DOM only | | | uniqueKey?: string
Defaults to random unique id | React DOM only | Use the same value of prop key, 
that will solve inconsistency on the SSR, see more here. | | beforeMask?: JSX.Element
Defaults to null | React DOM
React Native | Define custom shapes before content, 
see more here. |

See all options live

Examples

Facebook Style
import { Facebook } from 'react-content-loader'

const MyFacebookLoader = () => <Facebook />
Facebook Style
Instagram Style
import { Instagram } from 'react-content-loader'

const MyInstagramLoader = () => <Instagram />
Instagram Style
Code Style
import { Code } from 'react-content-loader'

const MyCodeLoader = () => <Code />
Code Style
List Style
import { List } from 'react-content-loader'

const MyListLoader = () => <List />
List Style
Bullet list Style
import { BulletList } from 'react-content-loader'

const MyBulletListLoader = () => <BulletList />
Bullet list Style

Custom Style

For the custom mode, use the online tool.

const MyLoader = () => (
  <ContentLoader
    height={140}
    speed={1}
    backgroundColor={'#333'}
    foregroundColor={'#999'}
    viewBox="0 0 380 70"
  >
    {/* Only SVG shapes */}
    <rect x="0" y="0" rx="5" ry="5" width="70" height="70" />
    <rect x="80" y="17" rx="4" ry="4" width="300" height="13" />
    <rect x="80" y="40" rx="3" ry="3" width="250" height="10" />
  </ContentLoader>
)

Custom

Troubleshooting

Responsive - Mobile version

In order to avoid unexpected behavior, the package doesn't have opinioned settings. So if it needs to be responsive, have in mind that the output of the package is a regular SVG, so it just needs the same attributes to become a regular SVG responsive, which means:

import { Code } from 'react-content-loader'

const MyCodeLoader = () => (
  <Code
    width={100}
    height={100}
    viewBox="0 0 100 100"
    style={{ width: '100%' }}
  />
)

Server-side rendering (SSR) - Match snapshot

As the main component generates random values to match the id of the SVG element with background style, it can encounter unexpected errors and unmatching warning on render, once the random value of id will be generated twice, in case of SSR: server and client; or in case of snapshot test: on the first match and re-running the test.

To fix it, set the prop uniqueKey, then the id will not be random anymore:

import { Facebook } from 'react-content-loader'

const MyFacebookLoader = () => <Facebook uniqueKey="my-random-value" />

Alpha is not working: Safari / iOS

When using rgba as a backgroundColor or foregroundColor value, Safari does not respect the alpha channel, meaning that the color will be opaque. To prevent this, instead of using a rgba value for backgroundColor/foregroundColor, use the rgb equivalent and move the alpha channel value to the backgroundOpacity/foregroundOpacity props.

{/* Opaque color in Safari and iOS */}
<ContentLoader
  backgroundColor="rgba(0,0,0,0.06)"
  foregroundColor="rgba(0,0,0,0.12)">


{/_ Semi-transparent color in Safari and iOS _/}
<ContentLoader
    backgroundColor="rgb(0,0,0)"
    foregroundColor="rgb(0,0,0)"
    backgroundOpacity={0.06}
    foregroundOpacity={0.12}>


Black box in Safari / iOS (again)

Using the base tag on a page that contains SVG elements fails to render and it looks like a black box. Just remove the base-href tag from the <head /> and the issue has been solved.

black box

See: #93 / 109

Browser supports SVG-Animate

Old browsers don't support animation in SVG (compatibility list), and if your project must support IE, for examples, here's a couple of ways to make sure that browser supports SVG Animate:

  • window.SVGAnimateElement
  • document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#SVG-Animation", "1.1")
  • Or even use https://modernizr.com/

Similar packages


Development

Fork the repo and then clone it

$ git clone git@github.com:YourUsername/react-content-loader.git && cd react-content-loader

$ npm i: Install the dependencies;

$ npm run build: Build to production;

$ npm run dev: Run the Storybook to see your changes;

$ npm run test: Run all tests: type checking, unit tests on web and native;

$ npm run test:watch: Watch unit tests;

React Native

As React Native doesn't support symbolic links (to link the dependency to another folder) and as there is no playground to check your contributions (like storybook), this is recommended strategy to run the project locally:

  1. Create a new React Native from scratch, either Metro or create-react-native-app;
  2. Install the dependency to your root project: yarn add react-content-loader react-native-svg
  3. Open the project just created and clone this repository there;
  4. Create your loading component and point the react-content-loader to the project just cloned, like: import ContentLoader, { Rect, Circle } from './react-content-loader/native'

Commit messages

Commit messages should follow the commit message convention so, changelogs could be generated automatically by that. Commit messages are validated automatically upon commit. If you aren't familiar with the commit message convention, you can use yarn commit (or npm run commit) instead of git commit, which provides an interactive CLI for generating proper commit messages.

License

MIT