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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-state-tabs

v3.0.2

Published

<p align="center"> <a href="https://www.npmjs.com/package/react-state-tabs"> </a> <img src="https://raw.githubusercontent.com/joaovitorzv/react-state-tabs/master/assets/logo.png" height="180"> </p> <p align="center"> <a href="https://github.com/

Readme

react-state-tabs

Your zero-effort content hidden-visible tabs. see examples live on codesandbox.io 🧰

Features

  • 🤯 Easy to use, Just two components and you're good to go.
  • 🚫 Disable any tab you want.
  • ♿ Accessibility, Screen readers and Keyboard Control.
  • 🪅 Animated transition element.

Quickstart ⤵️

The example above is simply that

/* 
* lineCursorExample.tsx
*/

import { useState } from "react";
import { Tab, Tabs } from "react-state-tabs";
import "./lineTabExample.css";

function LineCursorExample() {
  const [tabData, setTabData] = useState("");

  const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));

  async function fetchSomeData(activeId: number) {
    setTabData("fetching...");
    await delay(1000);
    return setTabData(`fetched data from ${activeId}`);
  }

  return (
    <Tabs
      defaultActiveTab={3}
      callbackOnMount={fetchSomeData}
      tabClassName="mytab"
      activeClassName="mytab--active"
      disabledClassName="mytab--disabled"
      contentContainerClassName="mytab-content"
      cursorClassName="mytab-cursor"
    >
      <Tab id={1} tabName="Tab">
        <p>{tabData}</p>
        <button type="button">another button</button>
      </Tab>
      <Tab id={2} tabName="Tab Two" disabled={true}>
        <p>{tabData}</p>
      </Tab>
      <Tab id={3} tabName="Tab Three large">
        <button type="button">button</button>
        <p>{tabData}</p>
      </Tab>
    </Tabs>
  );
}

export default LineCursorExample;
/* 
* lineCursorExample.css
*/

.mytab {
  padding: 10px 20px;
}

.mytab--active {
  color: #9f7eed;
}

.mytab--disabled {
  color: gray;
  cursor: default;
}

.mytab-content {
  background-color: #141414;
  padding: 1em;
}

.mytab-cursor {
  background-color: #9f7eed;
  height: 3px;

  transition: all 0.3s ease;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -ms-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
}

About the cursor (the bottom line)

There are two ways the animated cursor can behave: as a line (shown on the example above) or as a background.

  • line cursor: just pass any className you want on the cursorClassName prop and define the height, background, or animations desired to your cursor and it's done.
  • background cursor: in order to make the cursor animated and fill the active tab background pass a cursorAsBackground={true} prop and remove/do not add the height property from your cursorClassName styles.

API

<Tabs />

| Prop | Description | Type | Default | | ------------------ | --------------------------------------------------- | -------------------------------------------- | ---------------- | | defaultActiveTab? | set a tab to be active as default | number \| undefined | 1 | | callbackOnMount? | callback when tab is mounted/changed | (active: number) => void | - | | tabClassName? | className to all tab "buttons" | string \| undefined | - | | activeClassName? | className to all active tab "buttons" | string \| undefined | - | | disabledClassName? | className to all disabled tab "buttons"| string \| undefined | - | | contentContainerClassName? | className to the container of the content being shown | string \| undefined | - | | cursorClassName? | className to the animated cursor, be it line or background | string \| undefined | - | | cursorAsBackground? | make the cursor height fit the active tab "buttons" | boolean \| undefined | false |

<Tab />

| Prop | Description | Type | Default | | ------------------ | -------------------------------------------------- | -------------------------------------------- | ---------------- | | id | unique ID to match active tab with content visible | number *required | - | | tabName | name shown on tab button | string *required | - | | disabled? | disable a specific tab | boolean \| undefined | - |

License

MIT