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

livetabs

v1.0.4

Published

A lightweight, interactive tab management library for web applications

Readme

LiveTabs

Version Bundle Size Downloads License

LiveTabs is a small browser tab-management library. It creates tabs inside a target element, manages matching content panels, supports optional close buttons, exposes next/previous/programmatic switching, and can reorder tabs with native drag and drop.

Install

npm install livetabs

Browser CDN:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/LiveTabs.min.js"></script>

The npm package publishes the built files in dist/:

  • dist/LiveTabs.js
  • dist/LiveTabs.min.js
  • dist/LiveTabs.d.ts

Usage

Browser global:

<div id="tabs-container"></div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/LiveTabs.min.js"></script>
<script>
  const tabs = new LiveTabs({
    parentDiv: 'tabs-container',
    maxNumTabs: 5,
    allowDragAndDrop: true
  });

  tabs.addTab({
    tabTitle: 'Dashboard',
    addContent: (contentId) => {
      document.getElementById(contentId).textContent = 'Dashboard content';
    }
  });
</script>

CommonJS:

const LiveTabs = require('livetabs');

TypeScript:

import LiveTabs = require('livetabs');

const tabs = new LiveTabs({
  parentDiv: 'tabs-container',
  allowDragAndDrop: true,
});

API

Constructor

new LiveTabs(options: {
  parentDiv: string;
  maxNumTabs?: number;
  allowDragAndDrop?: boolean;
})
  • parentDiv: ID of the existing DOM element that will receive the tab list and content panels. The constructor throws if the element does not exist.
  • maxNumTabs: Optional non-negative integer. 0 prevents new tabs. If omitted, there is no limit.
  • allowDragAndDrop: Enables tab reordering with native drag and drop. Defaults to false.

Methods

addTab(params: {
  tabTitle: string;
  showCloseButton?: boolean;
  addContent?: (idContent: string) => void;
}): void

Adds a tab and creates its associated content panel. Exact duplicate titles switch to the existing tab instead of creating another one. Different titles that sanitize similarly still get unique DOM IDs.

removeTab(idTab: string): void
removeAllTabs(): void
switchTab(id: string): void
nextTab(): void
previousTab(): void
getActiveTab(): string
getAllTabs(): string[]
getTabCount(): number
setMaxTabs(newMax: number): void

getAllTabs() returns the generated tab IDs. Pass those IDs to switchTab() or removeTab().

Styling

LiveTabs does not ship CSS. Style these classes in your application:

  • .lt-container: tab list container, rendered with role="tablist"
  • .lt-tab: individual tab element, rendered with role="tab"
  • .lt-tab.active: active tab
  • .lt-tab-label: tab title text
  • .lt-tab-close-btn: close button inside a closable tab
  • .lt-tab.over: tab receiving a drag-over state
  • .lt-tab-content: content panel, rendered with role="tabpanel"

The repository includes a complete local example in example/index.html and example/css/style.css.

Development

npm install
npm test
npm run build
npm pack --dry-run

npm test builds the package and runs DOM regression tests from tests/liveTabs.dom.test.js.

License

MIT