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

elegans-tabs

v0.1.0

Published

A React segmented control with an elastic travelling active state.

Readme

Tabs

A React segmented control with an elastic travelling active state.

Tabs works with React 18.2 and newer. It includes keyboard navigation, focus states, dark mode and reduced-motion support.

Install

npm install elegans-tabs

Use it

"use client"

import { useState } from "react"
import { Tabs } from "elegans-tabs"

const views = ["Overview", "Activity", "Files", "Settings"] as const

export function Example() {
  const [view, setView] = useState<(typeof views)[number]>("Overview")

  return (
    <Tabs
      items={views}
      value={view}
      onValueChange={setView}
      ariaLabel="Workspace view"
      move={{
        springiness: 0.1,
        wobble: 0.7,
        stretch: 0.8,
      }}
    />
  )
}

items, value and onValueChange make this a controlled component. Your application owns the selected value.

Response 10%, Bounce 70% and Stretch 80% are built in. You only need move when you want different values.

Props

| Prop | Type | Required | Purpose | | --- | --- | --- | --- | | items | readonly string[] | Yes | Tabs shown in the control. | | value | One item from items | Yes | The selected tab. | | onValueChange | (value) => void | Yes | Runs when the selection changes. | | ariaLabel | string | Yes | Describes the tab list for assistive technology. | | panelId | string | No | Connects each tab to its tab panel. | | idBase | string | No | Sets predictable tab IDs. | | move | TabsMoveOptions | No | Adjusts response, bounce and stretch. | | reduced | boolean | No | Disables spatial motion when set to true. | | className | string | No | Adds a class to the outer control. |

Styling

The component imports its own CSS. Override these variables on the component or an ancestor to fit it into an existing design system:

.my-tabs {
  --liquid-tabs-surface: #ececec;
  --liquid-tab-rest-fill: #ffffff;
  --liquid-tab-motion-fill: #ffffff;
  --liquid-tab-active-ink: #171717;
  --liquid-tab-idle-ink: #6c6c6c;
  --focus-ring: #171717;
}

The component follows a surrounding data-theme="light" or data-theme="dark" attribute. Without one, it follows the operating system's colour preference.

Accessibility

  • Arrow Left and Arrow Right move between tabs.
  • Home and End move to the first and last tab.
  • Focus stays visible for keyboard users.
  • prefers-reduced-motion removes the spatial transition.
  • Add panelId when the tabs control a tab panel.

Licence

MIT