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

@mshafiqyajid/react-tabs

v0.4.1

Published

Headless tabs hook and styled component for React. Accessible, keyboard-friendly, animated, SSR-safe, fully typed.

Downloads

730

Readme

@mshafiqyajid/react-tabs

Headless tabs hook and styled component for React. Accessible, keyboard-friendly, animated, SSR-safe, fully typed.

Full docs →

Installation

npm install @mshafiqyajid/react-tabs

Quick start — styled component

import { TabsStyled } from "@mshafiqyajid/react-tabs/styled";
import "@mshafiqyajid/react-tabs/styles.css";

const tabs = [
  { value: "account", label: "Account", content: <div>Account settings</div> },
  { value: "security", label: "Security", content: <div>Security settings</div> },
  { value: "billing", label: "Billing", content: <div>Billing info</div>, disabled: true },
];

export function App() {
  return <TabsStyled tabs={tabs} defaultValue="account" />;
}

Quick start — headless hook

import { useTabs } from "@mshafiqyajid/react-tabs";

function MyTabs() {
  const { getTabProps, getPanelProps, activeValue } = useTabs({
    defaultValue: "account",
  });

  return (
    <div>
      <div role="tablist">
        <button {...getTabProps("account")}>Account</button>
        <button {...getTabProps("security")}>Security</button>
      </div>
      <div {...getPanelProps("account")}>Account content</div>
      <div {...getPanelProps("security")}>Security content</div>
    </div>
  );
}

Props — TabsStyled

| Prop | Type | Default | Description | |------|------|---------|-------------| | tabs | TabItem[] | required | Array of tab definitions | | variant | "line" \| "solid" \| "pill" | "line" | Visual style of the tab indicator | | size | "sm" \| "md" \| "lg" | "md" | Size of tabs | | tone | "neutral" \| "primary" | "neutral" | Color tone | | defaultValue | string | — | Initial active tab (uncontrolled) | | value | string | — | Controlled active tab | | onChange | (value: string) => void | — | Called when tab changes |

TabItem

interface TabItem {
  value: string;
  label: React.ReactNode;
  content: React.ReactNode;
  disabled?: boolean;
}

Props — useTabs

| Option | Type | Description | |--------|------|-------------| | defaultValue | string | Initial active tab (uncontrolled) | | value | string | Controlled active tab | | onChange | (value: string) => void | Called when tab changes | | tabs | { value: string; disabled?: boolean }[] | Tab definitions for keyboard navigation |

Returns

| Key | Type | Description | |-----|------|-------------| | activeValue | string \| undefined | Currently active tab value | | getTabProps | (value: string) => object | Spread onto each tab button | | getPanelProps | (value: string) => object | Spread onto each panel |

Keyboard navigation

| Key | Action | |-----|--------| | ArrowRight / ArrowDown | Move to next tab | | ArrowLeft / ArrowUp | Move to previous tab | | Home | Move to first tab | | End | Move to last tab |

Dark mode

Add data-theme="dark" to a parent element (or data-rtab-theme="dark" for component-scoped dark mode). Never uses @media (prefers-color-scheme: dark).

<div data-theme="dark">
  <!-- TabsStyled inherits dark mode here -->
</div>

License

MIT

What's new in 0.4.0

  • Closeable tabs (new API)tab.closeable?: boolean renders a × button with aria-label="Close <label>" and class="rtab-close". Pair with onClose(value). The closed tab animates its width to 0 before calling the handler.
  • Overflow scroll arrows fade — scroll arrows now always exist in the DOM and fade in/out via opacity when content overflows, for a smoother experience than conditional rendering.
  • Drag-reorder (new API)reorderable: true + onReorder(fromIndex, toIndex). Reports numeric indices instead of the full values array. The sortable / onReorder(values[]) API remains unchanged.
  • activationMode prop — alias for activation. "automatic" (default) activates on arrow key; "manual" moves focus only — Enter/Space activates.
  • Drop indicator — a thin line appears before the drop-target tab during drag-reorder.
  • style prop — the root <div> now accepts a style prop.

What's new in 0.3.0

  • Closeable tabstab.closable?: boolean renders a × button; pair with onTabClose(value).
  • Scrollable overflowscrollable: true keeps tabs on one line and renders chevron scroll buttons at the edges instead of wrapping.
  • Drag-to-reordersortable: true + onReorder(values: string[]). HTML5 DnD, no external dep.
  • Keyboard typeahead — letters jump to the first matching tab whose label starts with the buffer (600 ms reset).
  • scrollActiveIntoView — default true when scrollable. Keeps the active tab in the viewport on activation.