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-swim-button

v2.0.0

Published

![version](https://img.shields.io/github/package-json/v/happy-func/react-swim-button/main) ![typescript](https://img.shields.io/npm/types/react-swim-button) ![esm](https://img.shields.io/static/v1?label=build&message=esm&color=blue) ![npm bundle size (ver

Downloads

3

Readme

react-swim-button

version typescript esm npm bundle size (version) GitHub Repo stars

Zero dependencies

Getting Started

Install dependencies,

# npm
$ npm i react-swim-button
# yarn
$ yarn add react-swim-button

Usage

Basic

import React, { useState } from 'react';
import ReactSwimButton from 'react-swim-button';
import 'react-swim-button/es/style';

const texts = ['React', 'Swim', 'Button'];

export default () => {
  const [activeAt, setActiveAt] = useState('React');
  return (
    <div>
      {texts.map((text, index) => (
        <ReactSwimButton
          key={text}
          active={activeAt === text}
          loading={index === 0}
          style={{ marginRight: 16 }}
          onClick={() => setActiveAt(text)}
        >
          {text}
        </ReactSwimButton>
      ))}
    </div>
  );
};

Custom Primary Color

import React, { useState } from 'react';
import ReactSwimButton from 'react-swim-button';
import 'react-swim-button/es/style';

export default () => {
  const [activeAt, setActiveAt] = useState(0);
  return (
    <div>
      {Array.from({ length: 2 }).map((_, index) => (
        <ReactSwimButton
          primary="#ff7426"
          active={activeAt === index}
          style={{ marginRight: 16 }}
          onClick={() => setActiveAt(index)}
        >
          Custom Primary Color
        </ReactSwimButton>
      ))}
    </div>
  );
};

Custom Icon

import React, { useState } from 'react';
import ReactSwimButton from 'react-swim-button';
import 'react-swim-button/es/style';

const texts = [
  {
    text: 'React',
    icon: (
      <svg
        className="icon"
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        width="1em"
        height="1em"
      >
        <path
          d="M352.511759 832c-35.360409 0-64 28.639591-64 64 0 35.360409 28.639591 64 64 64s64-28.639591 64-64C416.511759 860.639591 387.872168 832 352.511759 832L352.511759 832z"
          fill="currentColor"
        />
        <path
          d="M800.511759 832c-35.360409 0-64 28.639591-64 64 0 35.360409 28.639591 64 64 64s64-28.639591 64-64C864.511759 860.639591 835.872168 832 800.511759 832L800.511759 832z"
          fill="currentColor"
        />
        <path
          d="M864.00086 800.00086l-519.775299 0c-46.111652 0-86.65674-36.480258-92.288671-83.039161l-54.272275-382.080258L166.783604 156.319634C164.863862 140.736353 150.65674 128 136.767854 128l-40.768714 0c-17.664722 0-32.00086-14.336138-32.00086-31.99914s14.336138-32.00086 32.00086-32.00086l40.768714 0c46.687918 0 87.680258 36.480258 93.343153 83.039161l30.815643 177.887488 54.495901 383.712727c1.792447 14.848757 15.232361 27.359763 28.79957 27.359763l519.775299 0c17.695686 0 31.99914 14.303454 31.99914 32.00086S881.696546 800.00086 864.00086 800.00086z"
          fill="currentColor"
        />
        <path
          d="M384.223626 672.00086c-16.60852 0-30.655665-12.8-31.871845-29.66483-1.312512-17.632039 11.93646-32.960731 29.535815-34.240559L816.00043 576.094611c15.935923-0.096331 29.375837-12.607338 31.1356-26.848864l50.400108-288.384464c1.279828-10.751243-1.696116-22.527725-8.12794-29.824808-4.128477-4.67206-9.311437-7.040774-15.359656-7.040774L320 223.9957c-17.664722 0-31.99914-14.336138-31.99914-32.00086s14.336138-32.00086 31.99914-32.00086l554.048542 0c24.447467 0 46.911544 10.144013 63.263755 28.608628 18.688241 21.087918 27.263432 50.816396 23.52028 81.632039l-50.432791 288.415428c-5.439269 44.864507-45.951673 81.344765-92.063325 81.344765l-431.74412 31.904529C385.792447 671.968176 384.992555 672.00086 384.223626 672.00086z"
          fill="currentColor"
        />
      </svg>
    ),
  },
  {
    text: 'Swim',
  },
  {
    text: 'Button',
  },
];

export default () => {
  const [activeAt, setActiveAt] = useState('React');
  return (
    <div>
      {texts.map((item, index) => (
        <ReactSwimButton
          key={item.text}
          icon={item.icon}
          active={activeAt === item.text}
          style={{ marginRight: 16 }}
          onClick={() => setActiveAt(item.text)}
        >
          {item.text}
        </ReactSwimButton>
      ))}
    </div>
  );
};

Support By