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

dynamic-spinner

v1.5.0

Published

A dynamic spinner component for ReactJS with customizable features

Downloads

77

Readme

Dynamic Spinner Component for React

A customizable and dynamic spinner component for React applications. The dynamic-spinner component allows you to easily add loading spinners to your React projects, with configurable properties like colors, size, speed, border size, opacity, shape and text. The component supports single or multiple colors with conic gradient and can be styled with various shapes.

Table of Contents

Installation

To install the dynamic-spinner component using npm, run the following command:

npm install dynamic-spinner

Alternatively, dynamic-spinner can be installed using yarn, the the following command:

yarn add dynamic-spinner

Usage

Once the package is installed, you can import and use the Spinner component in your React project:

import React from 'react';
import { Spinner } from 'dynamic-spinner';

const App = () => (
  <div>
    <Spinner
      size={80}
      colors={['#FF5733', '#33FF57', '#3357FF']}
      speed={1.5}
      text="Loading..."
      shape={50}
      borderSize={5}
      opacity={0.9}
    />
  </div>
);

export default App;

Props

The Spinner component accepts the following customizable props:

| Prop | Type | Default | Description | | ------------- | ------------------- | --------------------------- | -------------------------------------------------------------------------------------------- | | size | number | 50 | Size of the spinner in pixels (width and height). | | colors | array of strings | ['#4285F4', '#DB4437', '#F4B400', '#0F9D58'] | Array of colors for the spinner. A gradient will be applied if more than one color is provided.| | speed | number | 1 | Speed of the spinner animation, in seconds. | | text | string | "" | Optional text to display below the spinner. | | shape | number | 50 | Controls the shape of the spinner through border-radius. A value of 50 gives a circle, 0 for a square. Value is in % | | opacity | number | 1 | Opacity of the spinner (between 0 and 1). | | borderSize | number | 4 | Size of the border used for the spinner (affects thickness of the spinner). Value is in pixels. |

Example of colors Prop:

  • If you pass an array of colors, the spinner will apply a conic-gradient around the border using those colors.
  • For example:
colors={['#FF5733', '#33FF57', '#3357FF']}

will apply a gradient from orange, green, and blue.

Customization Examples

Here are some ways you can customize the spinner:

  1. Single Color Circle Spinner
<Spinner size={60} colors={['#3498db']} speed={1} shape={50} />
  1. Multi-Color Square Spinner
<Spinner size={80} colors={['#f00', '#0f0', '#00f']} speed={2} shape={0} borderSize={8} />
  1. Spinner with Loading Text
<Spinner size={70} colors={['#FF6347', '#4682B4']} text="Please wait..." />
  1. Fast Spinner with Transparent Opacity
<Spinner size={100} colors={['#FF5733', '#C70039']} speed={0.5} opacity={0.5} />

Contributing

We welcome contributions! If you want to report a bug, request a feature, or submit a pull request, please check out the Contributing Guidelines.

To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Push to your branch and submit a pull request.

License

This project is licensed under the ISC License.