npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-text-skeleton

v1.0.0

Published

A simple and small react library in order to create a loading text skeleton that either blurs out a dummy text or displays a loading gradient until the loaded text is provided.

Downloads

2

Readme

React Text Skeleton

A simple and small react library in order to create a text skeleton that either blurs out a dummy text or displays a loading gradient until the final text is loaded. The advantage is that it the blurred/gradient length is determined by the dummy text that should aproximatelly match the length of the data that is going to be fetched(it also takes in consideration the font-size). This way it creates a nice simple effect without the need of measuring the data that is beining loaded in a fixed pixel ratio. Demo: https://techbinator.github.io/react-text-skeleton

Features

  • React Text Skeleton Loader
  • You can create easily a text skeleton without providing exact dimensions
  • You can select from blurred or gradient effect
  • Can override the styles
  • It takes the parrent and/or children css properties (like font size or font type) and it generates the effect while keepping the exact dimensions.

Installation

npm i react-text-skeleton

Usage

Add the dummyText prop while having a text similar to the one that is fetched. For example if a price that has 3 digits set the dummyText with a 3 digits number. Once the children prop is provided the blurring and dummy text are replaced with that.

<TextSkeleton dummyText="Dummy text">{realText}</TextSkeleton>

dummyText: string; className?: string; skeletonType?: 'blurred' | 'gradient';

Props

<TextSkeleton>

| Name | Type | Default | Description | | ------------ | ------ | --------- | -------------------------------------------------------------------------------------------------------------------------- | | dummyText | string | null | Mandatory field, provide a string of a length that has aproximatelly the same dimensions as the data that is being fetched | | className | string | '' | Extra class(es) that would be prepended | | skeletonType | string | 'blurred' | The desired effect can be either 'blurred' or 'gradient' |

Example

import React from 'react';

import TextSkeleton from 'react-text-skeleton';

const App: React.FC = () => {
  return <TextSkeleton dummyText="Dummy text">{loadingText}</TextSkeleton>;
};

License

MIT