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

@logicblocks/react-tabs

v1.0.4

Published

A customizable React tab component with no built-in CSS.

Downloads

12

Readme

npm version License: MIT GitHub stars

@logicblocks/react-tabs

A customizable React tab component with no built-in CSS — completely style-agnostic and perfect for logic-only UI builds.


🚀 Installation

Using npm:

npm install @logicblocks/react-tabs

Using yarn:

yarn add @logicblocks/react-tabs

💡 Usage Examples


1️⃣ With CSS Classes

📦 Example CSS

/* tabs.css */

.tabs {
  display: flex;
  flex-direction: column;
  border: 1px solid #ccc;
  padding: 12px;
}

.tab-options {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 10px;
}

.selected {
  background-color: #007bff;
  color: white;
  padding: 8px 16px;
  border-radius: 4px 4px 0 0;
  border: 1px solid #007bff;
  border-bottom: none;
  cursor: pointer;
}

.unselected {
  background-color: #f1f1f1;
  color: #333;
  padding: 8px 16px;
  border-radius: 4px 4px 0 0;
  border: 1px solid #ccc;
  cursor: pointer;
}
import React, { useState } from 'react';
import { Tab } from '@logicblocks/react-tabs';
import './tabs.css'; // Your own CSS file

const Tab1 = () => <div>Tab 1 content</div>;
const Tab2 = () => <div>Tab 2 content</div>;

const App = () => {
  const [index, setIndex] = useState(0);

  const tabList = [
    { name: 'Tab 1', Component: Tab1 },
    { name: 'Tab 2', Component: Tab2 }
  ];

  return (
    <Tab
      tabList={tabList}
      currentTabIndex={index}
      tabClickHandler={setIndex}
      selectTabClass="selected"
      unselectedTabClass="unselected"
      tabContainerClass="tabs"
      tabOptionsClass="tab-options"
    />
  );
};

export default App;

2️⃣ With Inline Styles

import React, { useState } from 'react';
import { Tab } from '@logicblocks/react-tabs';

const Tab1 = () => <div>Tab 1 content</div>;
const Tab2 = () => <div>Tab 2 content</div>;

const App = () => {
  const [index, setIndex] = useState(0);

  const tabList = [
    { name: 'Tab 1', Component: Tab1 },
    { name: 'Tab 2', Component: Tab2 }
  ];

  return (
    <Tab
      tabList={tabList}
      currentTabIndex={index}
      tabClickHandler={setIndex}
      selectTabStyle={{ color: 'white', backgroundColor: 'blue' }}
      unselectedTabStyle={{ color: 'black', backgroundColor: '#f0f0f0' }}
      tabContainerStyle={{ padding: '12px', border: '1px solid #ddd' }}
      tabOptionsStyle={{ display: 'flex', gap: '8px' }}
    />
  );
};

export default App;

3️⃣ With Tailwind CSS (v3.4+)

💡 Ensure Tailwind is set up and you're using at least v3.4.0

import React, { useState } from 'react';
import { Tab } from '@logicblocks/react-tabs';

const Tab1 = () => <div className="p-4 text-gray-700">Tab 1 content</div>;
const Tab2 = () => <div className="p-4 text-gray-700">Tab 2 content</div>;

const App = () => {
  const [index, setIndex] = useState(0);

  const tabList = [
    { name: 'Tab 1', Component: Tab1 },
    { name: 'Tab 2', Component: Tab2 }
  ];

  return (
    <Tab
      tabList={tabList}
      currentTabIndex={index}
      tabClickHandler={setIndex}
      selectTabClass="bg-blue-600 text-white px-4 py-2 rounded-t"
      unselectedTabClass="bg-gray-100 text-gray-700 px-4 py-2"
      tabContainerClass="border border-gray-300 p-4 rounded"
      tabOptionsClass="flex gap-2 border-b border-gray-300"
    />
  );
};

export default App;

📦 Props

✅ Required Props

  • tabList: Array of tab configs:
    • name (string): Tab label
    • Component (React.FC): Component rendered for the tab
  • currentTabIndex (number): Currently active tab index

⚙️ Optional Props

  • tabClickHandler: Callback when a tab is clicked — receives index (function)
  • selectTabClass: CSS class for the selected tab (string)
  • unselectedTabClass: CSS class for unselected tabs (string)
  • tabContainerClass: Class for tab wrapper (string)
  • tabOptionsClass: Class for tab selector container (string)
  • selectTabStyle: Inline style for selected tab
  • unselectedTabStyle: Inline style for unselected tabs
  • tabContainerStyle: Inline style for outer tab container
  • tabOptionsStyle: Inline style for the tab options container

🎨 Example CSS

Use your own styles, or start with this:

.tab-container {
  display: flex;
  flex-direction: column;
}

.tab-options {
  display: flex;
  border-bottom: 1px solid #ccc;
}

.selected-tab {
  padding: 10px 20px;
  border: 1px solid #ccc;
  border-bottom: none;
  cursor: pointer;
  background-color: #f9f9f9;
}

.unselected-tab {
  padding: 10px 20px;
  cursor: pointer;
}

🤝 Contributing

Contributions are welcome!
Feel free to open an issue or submit a pull request on GitHub.


📄 License

MIT License © Anup Agarwal