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-skeleton-builder

v0.5.4

Published

A versatile React component library for creating customizable skeleton loading animations with Chakra UI and TypeScript.

Downloads

62

Readme

React Skeleton Builder

A lightweight React component library for building skeletons with TypeScript and Chakra UI.

Installation

npm i react-skeleton-builder

Usage

In the root of your providers

import { ReactSkeletonProvider } from 'react-skeleton-builder';

<ReactSkeletonProvider
    value={{
        // Initialy we can put empty object.
        // Check the props to customize the builder's behaviour
    }} 
>
    {children}
</ReactSkeletonProvider>

Example of Skeleton Component

You can generate the grid structure by visiting the website.

import React from 'react';
import { Skeleton } from 'react-skeleton-builder';

const ExampleComponent: React.FC = () => {
return (
<Skeleton
    styles={{
        width: '100%',
        height: '60px',
    }}
    grid={{
        children: [
            {
                w: '60px',
                skeletons: [
                    {
                        h: '60px',
                        r: '50%',
                    },
                ],
            },
            {
                direction: 'column',
                gridGap: '.5',
                skeletons: [
                    { r: '.4rem', w: '80%' },
                    { r: '.4rem', w: '60%' },
                    { r: '.4rem', w: '30%' },
                ],
            },
        ],
    }}
    />
);
};

export default ExampleComponent;

The result is this:

API

Props of ReactSkeletonProvider

| Props | type | required | defaultValue | |----------------------|----------------------------------|----------|--------------| | children | ReactNode | true | | | value | Object (check appropriate table) | true | {} |

value prop consist of these:

| Props | type | required | defaultValue | |-------------------|------------------------------------------------|----------|-----------------------------------| | isDark | boolean | false | false | | colorTheme | Object (ColorThemes) (check appropriate table) | false | DEFAULT_COLOR_THEMES | | breakpoints | Object (Breakpoints) (check appropriate table) | false | DEFAULT_BREAKPOINTS | | skeletonAnimation | string | false | SKELETON_ANIMATION_VARIANTS.SLIDE |

colorTheme prop consist of these:

| Props | type | required | defaultValue | |-------|-----------------------------------------|----------|------------------------------------------| | dark | Object {main: string, gradient: string} | true | { main: '#282c34', gradient: '#2c303a' } | | light | Object {main: string, gradient: string} | true | { main: '#f1f1f1', gradient: '#ececec' } |

breakpoints prop consist of these:

| Props | type | required | defaultValue | |---------|--------|----------|--------------| | mobile | string | true | 576px | | tablet | string | true | 961px | | desktop | string | true | 962px > |

Props of Skeleton

| Props | type | required | defaultValue | |----------------------|--------------------------------------------------------------------------|----------|--------------| | styles | Object | false | {} | | customContainerWidth | number (breakpoints will work with that width instead of window's width) | false | | | grid | IGrid (object) | true | |

If you encounter any issues, please visit this link.

If my builder was helpful for you, you can show your support by

You can reach out to me via:

And thanks for using my builder :)