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

aravint-ui-navigation

v1.0.24

Published

A reusable, dependency-free React + TypeScript tabs component with numbered badges, sticky tab bar, and mobile-responsive sizing — while preserving the original desktop/tablet look exactly.

Downloads

2,412

Readme

CustomTabs

A reusable, dependency-free React + TypeScript tabs component with numbered badges, sticky tab bar, and mobile-responsive sizing — while preserving the original desktop/tablet look exactly.

Features

  • Controlled or uncontrolled usage (value/onValueChange or defaultValue)
  • Numbered badges per tab (optional)
  • Optional icons per tab
  • Disabled tab support
  • Sticky tab bar (position: sticky; top: 0)
  • Active-tab underline-hiding trick (marginBottom: -1) to visually merge the active tab with its content panel
  • Responsive breakpoints for tablet (≤768px) and phone (≤480px) that only affect sizing (padding, font-size, gap, badge size) — colors, borders, and desktop layout are untouched
  • On phones, tabs wrap to a new row instead of overflowing or forcing horizontal scroll

Installation

Copy CustomTabs.tsx into your project (e.g. src/components/CustomTabs.tsx). No extra dependencies — just React.

Basic Usage

import CustomTabs, { TabItem } from "@digitus-fci-oa/navigation";

const tabs: TabItem[] = [
  { id: "overview", label: "Overview", content: <OverviewPanel /> },
  { id: "details", label: "Details", content: <DetailsPanel /> },
  { id: "history", label: "History", content: <HistoryPanel />, disabled: true },
];

function App() {
  const [activeTab, setActiveTab] = useState("overview");

  return (
    <div className="h-screen bg-gray-50 flex flex-col">
      <div className="flex-1 min-h-0">
        <CustomTabs
          tabs={tabs}
          value={activeTab}
          onValueChange={setActiveTab}
          showTabNumbers
          className="h-full"
          tabListClassName="bg-white"
        />
      </div>
    </div>
  );
}

Props

| Prop | Type | Default | Description | |---|---|---|---| | tabs | TabItem[] | — | Required. Array of tab definitions. | | defaultValue | string | first tab's id | Initial active tab (uncontrolled mode). | | value | string | — | Active tab id (controlled mode). Providing this switches the component to controlled. | | onValueChange | (value: string) => void | — | Called when the user selects a tab. | | className | string | "" | Class on the outer wrapper. | | tabListClassName | string | "" | Class on the tab bar container. | | tabButtonClassName | string | "" | Class on each tab button. | | contentClassName | string | "" | Class on the content panel. | | showTabNumbers | boolean | true | Show/hide the numbered badge on each tab. | | showContent | boolean | true | Show/hide the content panel entirely (render tab bar only). | | animated | boolean | true | Enables the opacity transition on the content panel. |

TabItem

| Field | Type | Description | |---|---|---| | id | string | Required. Unique tab identifier. | | label | string | Required. Tab display text. | | content | React.ReactNode | Content rendered when this tab is active. | | disabled | boolean | Disables selection of this tab. | | icon | React.ReactNode | Optional icon rendered before the label. |

Controlled vs Uncontrolled

  • Uncontrolled: omit value. The component manages its own active tab internally, seeded by defaultValue (or the first tab).
  • Controlled: pass value + onValueChange. You own the active-tab state; the component only reports selection events.

Styling Approach

Colors, borders, radii, and the sticky/active-tab layout tricks are set as inline styles and are the same across all screen sizes — this is what keeps the desktop/tablet appearance unchanged.

Only size-related properties (padding, font-size, gap, badge width/height) live in an injected <style> block using CSS classes (.ctabs-list, .ctabs-btn, .ctabs-badge, .ctabs-label), because inline styles can't respond to @media queries. This block ships inside the component, so no external CSS file is required.

Breakpoints

| Breakpoint | Behavior | |---|---| | Desktop (default) | Original sizing: 8px 20px padding, 14px font, 20px badges. | | Tablet (≤768px) | Slightly reduced padding/font/badge size. Tab bar scrolls horizontally if tabs overflow. | | Phone (≤480px) | Further reduced padding/font/badge size. Tab bar wraps to a new row instead of scrolling, so every label stays fully visible. |

To customize breakpoint values, edit the @media blocks inside the component's <style> tag directly.

Notes / Gotchas

  • marginBottom: -1 on the active tab intentionally overlaps the tab bar's bottom border so the active tab visually "merges" into its content panel. This depends on alignItems: "flex-end" on the tab list — don't remove that when customizing.
  • The phone-only flex-wrap: wrap sets overflow-x: visible to explicitly undo the tablet breakpoint's overflow-x: auto, since media query rules don't reset each other automatically.
  • If you have a large number of tabs, consider whether wrapping (phone behavior) or horizontal scroll suits your use case better, and adjust the 480px block accordingly.