Controls

Pill Tabs

Tabs in a dark pill, with the light pill flowing between them and a count beside each.

Preview

Installation

Terminal
npx @usefluid/cli add pill-tabs

Usage

PillTabs.tsx
import { PillTabs } from "./PillTabs";

<PillTabs label="Inbox" value={tab} onChange={setTab} tabs={[{ value: "new", label: "New", count: 3 }, { value: "all", label: "All" }]} />

API reference

PropTypeDefaultDescription
labelstring—Accessible name of the tab list.
valuestring—The current tab.
onChange(value) => void—
tabs{ value, label, count? }[]—

Keyboard and screen readers

A tab list: arrow keys move between tabs. Give the panel below role="tabpanel".

Notes

For filters that do not switch panels, use SegmentedPicker.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

The same flow as the site's navbar: each edge of the light pill has its own spring, and the front one leaves before the back one. The arrow keys move between tabs, and each tab can carry a count.

For your agent

For your agent

Add Pill Tabs to my project with the Fluid library. Use PillTabs on the filtered lists of my product, with the real counts. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.