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

sparkle-button

v1.0.6

Published

A sparkly button similar to the Discord activities button

Downloads

5

Readme

SparkleButton

A customizable, animated circular button component for React applications. The SparkleButton features an icon in the center, surrounded by sparkles that animate in a clockwise rotation. The button has customizable colors, sizes, and sparkles.

Sparkle Button

Installation

To install the SparkleButton package, run:

npm install sparkle-button

Or if using yarn:

yarn add sparkle-button

Usage

First, import the SparkleButton component:

import SparkleButton from 'sparkle-button';

Then, use the SparkleButton component in your React application:

<SparkleButton />

Customization

You can customize various aspects of the SparkleButton component, such as the icon, size, colors, and more. Here are some examples:

Changing the Icon

NOTE: If there is an issue with the size not working correctly you may have to remove the "width=" attribute from the svg To change the SVG icon, pass the icon prop to the SparkleButton component:

const rocketIcon = (
  <svg viewBox="0 0 512 512">
    <path d="M505.12019,19.09375c-1.18945-5.53125-6.65819-11-12.207-12.1875C460.716,0,435.507,0,410.40747,0,307.17523,0,245.26909,55.20312,199.05238,128H94.83772c-16.34763.01562-35.55658,11.875-42.88664,26.48438L2.51562,253.29688A28.4,28.4,0,0,0,0,264a24.00867,24.00867,0,0,0,24.00582,24H127.81618l-22.47457,22.46875c-11.36521,11.36133-12.99607,32.25781,0,45.25L156.24582,406.625c11.15623,11.1875,32.15619,13.15625,45.27726,0l22.47457-22.46875V488a24.00867,24.00867,0,0,0,24.00581,24,28.55934,28.55934,0,0,0,10.707-2.51562l98.72834-49.39063c14.62888-7.29687,26.50776-26.5,26.50776-42.85937V312.79688c72.59753-46.3125,128.03493-108.40626,128.03493-211.09376C512.07526,76.5,512.07526,51.29688,505.12019,19.09375ZM384.04033,168A40,40,0,1,1,424.05,128,40.02322,40.02322,0,0,1,384.04033,168Z" />
  </svg>
);
<SparkleButton icon={rocketIcon} />

Changing the button's icon

Changing the Size

To change the size of the button, pass the size prop to the SparkleButton component:

<SparkleButton size={60} />

The size prop accepts a number representing the diameter of the button in pixels. Changing the button's size

Customizing Colors

You can customize the background and icon colors by passing the backgroundColor, hoverBackgroundColor, activeBackgroundColor, and iconColor props:

<SparkleButton
  backgroundColor="#333"
  hoverBackgroundColor="#555"
  activeBackgroundColor="#222"
  iconColor="#FFF"
/>

Changing Button's normal, hover, active colors

Customizing Sparkles

To customize the sparkles, pass the sparkleColors prop to the SparkleButton component:

<SparkleButton sparkleColors={['red', 'yellow', 'green', 'fuchsia', 'white', 'pink', 'PaleGreen', 'SlateGray']} />

The sparkleColors prop accepts an array of color strings. Changing the button's sparkles's colors

Positioning the Icon

To customize the icon's position within the button, pass the iconOffsetX and iconOffsetY props:

<SparkleButton iconOffsetX={-2} iconOffsetY={3} />

The iconOffsetX and iconOffsetY props accept numbers representing the horizontal and vertical offset in percentages, respectively. Changing icon position

Stop Sparkles on Click

To make the sparkles stop animating after the button is clicked, pass the stopSparklesOnClick prop:

<SparkleButton stopSparklesOnClick />

Stop sparkling after button click

Props

| Prop | Type | Required | Description | Default Value | |---------------------|-------------------------|----------|------------------------------------------------------------------------------|---------------| | icon | ReactNode | No | The SVG icon or React component to display in the center of the button | Rocket Icon | | size | number | No | The diameter of the button in pixels | 60 | | backgroundColor | string | No | The background color of the button | '#333' | | hoverBackgroundColor | string | No | The background color of the button when hovered | '#555' | | activeBackgroundColor | string | No | The background color of the button when active (pressed) | '#222' | | iconColor | string | No | The color of the icon | '#FFF' | | sparkleColors | Array | No | An array of color strings for the sparkles | (see below) | | iconOffsetX | number | No | The horizontal offset of the icon in percentage | 0 | | iconOffsetY | number | No | The vertical offset of the icon in percentage | 0 | | stopSparklesOnClick | boolean | No | If true, the sparkles will stop animating when the button is clicked | false |

Default sparkleColors: ['red', 'yellow', 'green', 'fuchsia', 'white', 'pink', 'PaleGreen', 'SlateGray']

License

This project is licensed under the MIT License.