# Phone tab bar (Notchset): prompt.md (v1.1.0)

- id: `phone-tab-bar` · version 1.1.0 · component · free
- category: App shell
- build: one set of files for every shadcn style
- install: `npx shadcn@latest add https://notchset.dev/r/phone-tab-bar.json`
- npm dependencies: lucide-react@^1
- registry dependencies: utils, https://notchset.dev/r/notchset-foundation.json, @notchset/bottom-sheet
- docs: https://notchset.dev/components/phone-tab-bar
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

The tabs a thumb reaches, docked and frosted at a phone's foot. One raised pill glides to the tab you're on; unread shows as a count, a dot means something needs you; More holds every other page and lights while you're on one; the app's one action (+ Log) is the last slot..

## Build it
- Stack: React 18.3 or 19, TypeScript, Tailwind CSS v4 utility classes on the foundation's roles, a components.json (imports use its aliases).
- Packages: `lucide-react@^1` beyond `react` and `react-dom`.
- Files: `components/ui/notchset/phone-tab-bar.tsx`; shared code: `lib/notchset/count.ts`, `lib/notchset/feedback.ts`, `lib/notchset/glide.ts`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`, `lib/notchset/words.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `notchset-foundation`, `bottom-sheet`.
- Builds: one set of files, the same for every shadcn style.
- Exports to keep: `PHONE_TAB_BAR_LABELS`, `PhoneTabBar`, and every exported type.
- CSS: the install adds the notchset foundation (its roles, keyframes and motion switch, reading your shadcn tokens for colour) to your global stylesheet once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- This item reads `--ns-bezel`, `--ns-canvas`, `--ns-ease`, `--ns-ease-move`, `--ns-ease-pop`, `--ns-font-display`, `--ns-ink`, `--ns-ink-3`, `--ns-layer-bar`, `--ns-lift`, `--ns-line`, `--ns-panel`, `--ns-radius-lg`, `--ns-raised`, `--ns-shadow-float`, `--ns-signal`, `--ns-text-meta`, `--ns-time-color`, `--ns-time-panel`, `--ns-time-quick`, `--ns-time-toast`, `--ns-warn`, `--ns-weight-medium`, `--ns-weight-strong`.
- Retune it (on any ancestor) with the foundation's roles and hooks: `--ns-agent-b`, `--ns-agent-c`, `--ns-agent-d`, `--ns-agent-drift`, `--ns-agent-fill`, `--ns-agent-h1`, `--ns-agent-h2`, `--ns-agent-h3`, `--ns-agent-shift`, `--ns-avatar-card`, `--ns-avatar-lg`, `--ns-avatar-md`, `--ns-avatar-sm`, `--ns-avatar-xs`, `--ns-bad`, `--ns-bad-ink`, `--ns-band`, `--ns-band-edge`, `--ns-band-grade`, `--ns-band-optimal`, `--ns-banner-beat`, `--ns-banner-radius`, `--ns-beat`, `--ns-beat-ease`, `--ns-bezel`, `--ns-bloom-close`, `--ns-bloom-open`, `--ns-bloom-rise`, `--ns-btn-bad`, `--ns-btn-bad-hover`, `--ns-btn-bad-line`, `--ns-btn-bezel`, `--ns-btn-chosen`, `--ns-btn-gone`, `--ns-btn-morph`, `--ns-btn-ok`, `--ns-btn-press`, `--ns-btn-release`, `--ns-btn-result`, `--ns-btn-roll`, `--ns-btn-stagger`, `--ns-btn-stagger-step`, `--ns-btn-tick`, `--ns-btn-tonal`, `--ns-btn-tonal-edge`, `--ns-btn-tonal-hover`, `--ns-bulk-clear`, `--ns-button`, `--ns-button-field-inset`, `--ns-button-lg`, `--ns-button-sm`, `--ns-canvas`, `--ns-card-tilt`, `--ns-cat-1`, `--ns-cat-2`, `--ns-cat-3`, `--ns-cat-4`, `--ns-cat-5`, `--ns-cat-6`, `--ns-check`, `--ns-check-round`, `--ns-cheer-1`, `--ns-cheer-2`, `--ns-cheer-3`, `--ns-cheer-edge`, `--ns-cheer-fold`, `--ns-cheer-glow`, `--ns-cheer-lift`, `--ns-chip`, `--ns-chip-pick`, `--ns-control`, `--ns-control-lg`, `--ns-control-pad`, `--ns-control-sm`, `--ns-corner`, `--ns-danger`, `--ns-deep`, `--ns-deep-ink`, `--ns-deep-ink-2`, `--ns-deep-line`, `--ns-depth-card`, `--ns-depth-lift`, `--ns-depth-surface`, `--ns-dialog`, `--ns-dialog-grow`, `--ns-dialog-lg`, `--ns-dialog-max`, `--ns-dialog-shrink`, `--ns-dialog-sm`, `--ns-dialog-top`, `--ns-dock-bottom`, `--ns-drop`, `--ns-ease`, `--ns-ease-arrive`, `--ns-ease-breathe`, `--ns-ease-drum`, `--ns-ease-exit`, `--ns-ease-fling`, `--ns-ease-glide`, `--ns-ease-grow`, `--ns-ease-move`, `--ns-ease-panel`, `--ns-ease-pop`, `--ns-ease-press`, `--ns-ease-spring`, `--ns-ebg-arm`, `--ns-ebg-lit`, `--ns-emoji`, `--ns-emoji-md`, `--ns-emoji-sm`, `--ns-field`, `--ns-field-edge`, `--ns-field-h`, `--ns-fill`, `--ns-fill-time`, `--ns-flood-arc`, `--ns-flood-aurora`, `--ns-flood-behind-1`, `--ns-flood-behind-2`, `--ns-flood-bloom`, `--ns-flood-deep`, `--ns-flood-dial-bloom`, `--ns-flood-glass`, `--ns-flood-grain`, `--ns-flood-image`, `--ns-flood-ink`, `--ns-flood-ink-low`, `--ns-flood-light`, `--ns-flood-mid`, `--ns-flood-pale`, `--ns-flood-pane`, `--ns-flood-pane-edge`, `--ns-flood-pill-ink`, `--ns-flood-ribbon`, `--ns-flood-ribbon-core`, `--ns-flood-shadow`, `--ns-flood-sheen`, `--ns-flood-wash`, `--ns-font-body`, `--ns-font-display`, `--ns-font-mono`, `--ns-font-script`, `--ns-glass`, `--ns-glass-blur`, `--ns-glass-shadow`, `--ns-glow`, `--ns-glyph-pad`, `--ns-grain`, `--ns-gutter`, `--ns-header`, `--ns-help-max`, `--ns-hit`, `--ns-hover`, `--ns-icon`, `--ns-icon-lg`, `--ns-icon-sm`, `--ns-icon-stroke`, `--ns-info`, `--ns-info-ink`, `--ns-ink`, `--ns-ink-2`, `--ns-ink-3`, `--ns-ink-4`, `--ns-layer-bar`, `--ns-layer-modal`, `--ns-layer-panel`, `--ns-layer-popup`, `--ns-layer-sticky`, `--ns-layer-tip`, `--ns-layer-toast`, `--ns-layer-zoom`, `--ns-lead-body`, `--ns-lead-figure`, `--ns-lead-large`, `--ns-lead-meta`, `--ns-lead-small`, `--ns-lead-sub`, `--ns-lead-title`, `--ns-leading`, `--ns-leading-prose`, `--ns-leading-title`, `--ns-lift`, `--ns-light-1`, `--ns-light-2`, `--ns-light-3`, `--ns-light-spread`, `--ns-light-strength`, `--ns-line`, `--ns-line-soft`, `--ns-lit-edge`, `--ns-map-grass`, `--ns-map-water`, `--ns-mark-edge`, `--ns-mark-lifted`, `--ns-mark-rest`, `--ns-mark-swap`, `--ns-marker`, `--ns-marker-ink`, `--ns-mc-place`, `--ns-mc-roll`, `--ns-measure`, `--ns-menu-dy`, `--ns-menu-lit`, `--ns-menu-pad`, `--ns-menu-row`, `--ns-menu-rule`, `--ns-mesh`, `--ns-mesh-frost`, `--ns-nest-inset`, `--ns-nest-outer`, `--ns-nest-r`, `--ns-notch-ease`, `--ns-ok`, `--ns-ok-ink`, `--ns-on-fill`, `--ns-orb-body`, `--ns-orb-cool`, `--ns-orb-core`, `--ns-orb-dawn`, `--ns-orb-deep`, `--ns-orb-edge`, `--ns-orb-grain`, `--ns-orb-ground`, `--ns-orb-halo`, `--ns-orb-inner`, `--ns-orb-key`, `--ns-orb-lift`, `--ns-orb-limb`, `--ns-orb-limb-from`, `--ns-orb-rim`, `--ns-orb-skin-hi`, `--ns-orb-skin-lo`, `--ns-orb-skin-mid`, `--ns-orb-warm`, `--ns-palette-min`, `--ns-panel`, `--ns-panel-room`, `--ns-panel-w`, `--ns-panel-w-lg`, `--ns-pick-slot`, `--ns-pill-prop`, `--ns-play-fill`, `--ns-play-fill-color`, `--ns-play-lift`, `--ns-play-lift-y`, `--ns-play-open`, `--ns-play-open-content`, `--ns-play-press`, `--ns-play-press-box`, `--ns-play-reduced`, `--ns-play-ring`, `--ns-play-roll`, `--ns-play-shake`, `--ns-play-spring`, `--ns-play-swap`, `--ns-play-swap-blur`, `--ns-press-min`, `--ns-press-scale`, `--ns-press-x`, `--ns-press-y`, `--ns-primary-hover`, `--ns-primary-press`, `--ns-prism-edge`, `--ns-prism-glint`, `--ns-prism-sheen`, `--ns-prism-tint`, `--ns-pulse`, `--ns-radius`, `--ns-radius-2xl`, `--ns-radius-button`, `--ns-radius-button-lg`, `--ns-radius-button-sm`, `--ns-radius-card`, `--ns-radius-check`, `--ns-radius-control`, `--ns-radius-control-sm`, `--ns-radius-float`, `--ns-radius-full`, `--ns-radius-lg`, `--ns-radius-mark`, `--ns-radius-menu-row`, `--ns-radius-modal`, `--ns-radius-pill`, `--ns-radius-sm`, `--ns-radius-xl`, `--ns-radius-xs`, `--ns-raised`, `--ns-ramp-1`, `--ns-ramp-2`, `--ns-ramp-3`, `--ns-ramp-4`, `--ns-ramp-5`, `--ns-ramp-shine`, `--ns-range`, `--ns-rest-1`, `--ns-rest-2`, `--ns-rest-3`, `--ns-rise`, `--ns-row`, `--ns-row-compact`, `--ns-row-hue`, `--ns-scrim`, `--ns-search-h`, `--ns-segment`, `--ns-segment-inset`, `--ns-segment-lift`, `--ns-segment-sm`, `--ns-selected`, `--ns-series`, `--ns-series-core`, `--ns-series-glint`, `--ns-series-tint`, `--ns-shadow-dialog`, `--ns-shadow-float`, `--ns-shadow-lift`, `--ns-shadow-panel`, `--ns-sheet`, `--ns-sheet-back`, `--ns-sheet-bottom`, `--ns-sheet-drop`, `--ns-sheet-rise`, `--ns-shift`, `--ns-side`, `--ns-signal`, `--ns-signal-ink`, `--ns-signal-wash`, `--ns-sk-figure`, `--ns-sk-land`, `--ns-sk-p`, `--ns-sk-p0`, `--ns-sk-p1`, `--ns-sk-p2`, `--ns-sk-p3`, `--ns-sk-p4`, `--ns-sk-p5`, `--ns-sk-p6`, `--ns-sk-p7`, `--ns-sk-read`, `--ns-sk-sweep`, `--ns-skeleton`, `--ns-skeleton-bone`, `--ns-skeleton-bone-light`, `--ns-skeleton-light`, `--ns-slab`, `--ns-slab-edge`, `--ns-slab-ink`, `--ns-sleep-awake`, `--ns-sleep-deep`, `--ns-sleep-light`, `--ns-sleep-rem`, `--ns-space-1`, `--ns-space-2`, `--ns-space-3`, `--ns-space-4`, `--ns-space-5`, `--ns-space-6`, `--ns-space-8`, `--ns-space-section`, `--ns-stack-fan`, `--ns-stack-fan-gap`, `--ns-stack-fan-lag`, `--ns-stack-on`, `--ns-stagger-item`, `--ns-stagger-mark`, `--ns-stagger-max`, `--ns-standing-critical`, `--ns-standing-in`, `--ns-standing-out`, `--ns-state-doing`, `--ns-state-done`, `--ns-state-review`, `--ns-state-todo`, `--ns-step`, `--ns-step-from`, `--ns-step-sign`, `--ns-swipe-surface`, `--ns-switch-h`, `--ns-switch-w`, `--ns-text-body`, `--ns-text-control`, `--ns-text-control-lg`, `--ns-text-display`, `--ns-text-editorial`, `--ns-text-empty`, `--ns-text-figure`, `--ns-text-giant`, `--ns-text-heading`, `--ns-text-headline`, `--ns-text-input`, `--ns-text-large`, `--ns-text-lede`, `--ns-text-meta`, `--ns-text-record`, `--ns-text-sentence`, `--ns-text-small`, `--ns-text-sub`, `--ns-text-title`, `--ns-theme-fade`, `--ns-tile-shadow`, `--ns-time-born`, `--ns-time-color`, `--ns-time-confirm`, `--ns-time-dialog`, `--ns-time-fling`, `--ns-time-flip`, `--ns-time-glide`, `--ns-time-grow`, `--ns-time-hold`, `--ns-time-menu`, `--ns-time-page`, `--ns-time-panel`, `--ns-time-quick`, `--ns-time-roll`, `--ns-time-settle`, `--ns-time-snap`, `--ns-time-spin`, `--ns-time-spring`, `--ns-time-sweep`, `--ns-time-toast`, `--ns-tint`, `--ns-tint-c`, `--ns-tint-ease`, `--ns-tint-fill`, `--ns-tint-gap`, `--ns-tint-h1`, `--ns-tint-h2`, `--ns-tint-h3`, `--ns-tint-ink`, `--ns-tint-row`, `--ns-tip-fold`, `--ns-tip-grow`, `--ns-toast-bottom`, `--ns-toast-gap`, `--ns-toast-left`, `--ns-toast-lift`, `--ns-toast-peek`, `--ns-toast-scale`, `--ns-toast-w`, `--ns-touch`, `--ns-tracking-body`, `--ns-tracking-caps`, `--ns-tracking-control`, `--ns-tracking-display`, `--ns-tracking-headline`, `--ns-tracking-sub`, `--ns-tracking-title`, `--ns-warn`, `--ns-warn-ink`, `--ns-wash-clay`, `--ns-wash-dusk`, `--ns-wash-graphite`, `--ns-wash-ink`, `--ns-wash-sage`, `--ns-wash-sand`, `--ns-weight-light`, `--ns-weight-medium`, `--ns-weight-regular`, `--ns-weight-strong`, `--ns-well`, `--ns-width-lg`, `--ns-width-md`, `--ns-width-sm`, `--ns-width-xl`.
- Never add Tailwind colour classes inside the component.

```tsx
import { SheetItem } from "@/components/ui/notchset/bottom-sheet";
```

## Parts
- A single export that takes props.

## Match the original
- Read `components/ui/notchset/phone-tab-bar.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- Every app's phone navigation: four tabs at most, then More (and an action slot when the app has one thing it is for).

### Not when
- On a desktop use the Sidebar; for slices of one list use Tabs.

## Built from
- bottom-sheet (`bottom-sheet`), installed with it: reuse it, don't rebuild it
- Count (shared helper, ships with it)
- Feedback (shared helper, ships with it)
- Glide (shared helper, ships with it)
- Icons (shared helper, ships with it)
- Motion (shared helper, ships with it)
- Words (shared helper, ships with it)

## Mistakes
- Recreating the component instead of installing it

## Usage

```tsx
"use client";
import * as React from "react";
import { Bell, CircleHelp, House, Inbox, Layers, Search, Settings } from "@/lib/notchset/icons";
import { SheetItem } from "@/components/ui/notchset/bottom-sheet";
import { EASE, useLessMotion } from "@/lib/notchset/motion";
import { PhoneTabBar } from "@/components/ui/notchset/phone-tab-bar";
import { StageLayer, stageLayerClass } from "@/lib/notchset/portal";
import { cn } from "@/lib/utils";
import { useSelfPlay } from "./self-play";

/*
 * The bar at the foot of a phone whose screen is only soft blocks: the screen's name alone says where you are. On first
 * sight a message lands (Inbox's count pops in) and the pill glides to Inbox, the screen sliding over to it with its
 * unread rows lit. Then every tab goes to its screen and More opens its sheet inside the phone. Five short names, so no
 * label is cut at any width. Less motion shows the inbox at once.
 */
type Tab = "home" | "inbox" | "projects" | "search" | "more";
const ORDER: Tab[] = ["home", "inbox", "projects", "search", "more"];
const LABELS = { home: "Home", inbox: "Inbox", projects: "Projects", search: "Search", more: "Settings", notifications: "Notifications", help: "Help" };

const block = "rounded-[12px] bg-[color-mix(in_oklab,var(--ns-ink)_6%,transparent)]";
const bar = (w: string, strong = false) => <span className={cn("block h-2 rounded-full", strong ? "bg-[color-mix(in_oklab,var(--ns-ink)_22%,transparent)]" : "bg-[color-mix(in_oklab,var(--ns-ink)_9%,transparent)]")} style={{ width: w }} />;

/* each place drawn as quiet shapes: the title above it names it */
function Screen({ tab, unread }: { tab: Tab; unread: number }) {
  if (tab === "inbox")
    return (
      <ul className="m-0 flex list-none flex-col p-0">
        {[0, 1, 2, 3, 4, 5].map((i) => (
          <li key={i} className="flex items-center gap-3 border-b border-[var(--ns-line-soft)] py-3">
            <span className={cn("size-8 shrink-0 rounded-full", i < unread ? "bg-[color-mix(in_oklab,var(--ns-signal)_16%,transparent)]" : "bg-[color-mix(in_oklab,var(--ns-ink)_7%,transparent)]")} />
            <span className="flex min-w-0 flex-1 flex-col gap-1.5">
              {bar(["62%", "48%", "70%", "55%", "40%", "58%"][i]!, i < unread)}
              {bar(["84%", "76%", "66%", "80%", "72%", "64%"][i]!)}
            </span>
            {i < unread ? <span className="size-2 shrink-0 rounded-full bg-[var(--ns-signal)]" /> : <span className="size-2 shrink-0" />}
          </li>
        ))}
      </ul>
    );
  if (tab === "projects")
    return (
      <div className="grid grid-cols-2 gap-2.5 pt-1">
        {[0, 1, 2, 3].map((i) => (
          <span key={i} className={cn(block, "flex h-[104px] flex-col justify-end gap-1.5 p-3")}>
            {bar(["70%", "54%", "62%", "48%"][i]!, true)}
            {bar("40%")}
          </span>
        ))}
      </div>
    );
  if (tab === "search")
    return (
      <div className="flex flex-col gap-3 pt-1">
        <span className={cn(block, "flex h-10 items-center gap-2 px-3")}>
          <Search aria-hidden className="size-4 text-[var(--ns-ink-3)]" />
          {bar("38%")}
        </span>
        {["56%", "44%", "62%", "36%"].map((w) => (
          <span key={w} className="flex items-center gap-3 py-1.5">
            <span className="size-6 shrink-0 rounded-[7px] bg-[color-mix(in_oklab,var(--ns-ink)_7%,transparent)]" />
            {bar(w)}
          </span>
        ))}
      </div>
    );
  if (tab === "more")
    return (
      <div className="flex flex-col gap-2 pt-1">
        {["52%", "40%", "60%", "46%"].map((w) => (
          <span key={w} className={cn(block, "flex h-12 items-center px-3")}>
            {bar(w)}
          </span>
        ))}
      </div>
    );
  return (
    <div className="flex flex-col gap-2.5 pt-1">
      <span className="flex h-[124px] flex-col justify-end gap-2 rounded-[14px] bg-[linear-gradient(135deg,color-mix(in_oklab,var(--ns-signal)_14%,transparent),color-mix(in_oklab,var(--ns-signal)_4%,transparent))] p-3.5">
        {bar("58%", true)}
        {bar("36%")}
      </span>
      <div className="grid grid-cols-2 gap-2.5">
        <span className={cn(block, "h-[76px]")} />
        <span className={cn(block, "h-[76px]")} />
      </div>
      <span className="flex flex-col gap-2 pt-1.5">
        {bar("72%")}
        {bar("54%")}
      </span>
    </div>
  );
}

export default function PhoneTabBarDemo() {
  const labels = LABELS;
  const less = useLessMotion();
  const root = React.useRef<HTMLDivElement>(null);
  const play = useSelfPlay(root, { beats: [0], off: less });
  const take = (e: React.SyntheticEvent) => {
    if (e.nativeEvent.isTrusted) play.handOver();
  };
  const [on, setOn] = React.useState<Tab>("inbox");
  const [dir, setDir] = React.useState(1);
  const [unread, setUnread] = React.useState(3);
  const [layer, setLayer] = React.useState<HTMLDivElement | null>(null);
  const screen = React.useRef<HTMLDivElement>(null);
  const first = React.useRef(true);
  const go = (t: Tab) => {
    setDir(ORDER.indexOf(t) >= ORDER.indexOf(on) ? 1 : -1);
    setOn(t);
  };
  /* the screen slides 12px in the travel direction as it changes */
  React.useLayoutEffect(() => {
    const el = screen.current;
    if (first.current) return void (first.current = false);
    if (!el || less || typeof el.animate !== "function") return;
    el.animate([{ opacity: 0, translate: `${dir * 12}px 0` }, { opacity: 1, translate: "0 0" }], { duration: 260, easing: EASE.move });
    // eslint-disable-next-line react-hooks/exhaustive-deps -- once per screen change
  }, [on]);
  /* the moment: a message lands on Inbox, then the pill glides there */
  React.useEffect(() => {
    if (play.step !== 0 || play.mine || less) return;
    const ids = [
      window.setTimeout(() => {
        setUnread(0);
        setDir(-1);
        setOn("home");
      }, 0),
      window.setTimeout(() => setUnread(3), 500),
      window.setTimeout(() => {
        setDir(1);
        setOn("inbox");
      }, 1500),
    ];
    return () => ids.forEach(clearTimeout);
  }, [play.step, play.mine, less]);
  const tabs = [
    { key: "home", label: labels.home, icon: <House />, onClick: () => go("home") },
    { key: "inbox", label: labels.inbox, icon: <Inbox />, onClick: () => go("inbox"), badge: unread || undefined },
    { key: "projects", label: labels.projects, icon: <Layers />, onClick: () => go("projects") },
    { key: "search", label: labels.search, icon: <Search />, onClick: () => go("search") },
  ];
  const title: Record<Tab, string> = { home: labels.home, inbox: labels.inbox, projects: labels.projects, search: labels.search, more: labels.more };
  return (
    <div ref={root} onPointerDownCapture={take} onKeyDownCapture={take} className="flex w-full justify-center">
      <div data-slot="phone-frame" className="w-[312px] max-w-full rounded-[44px] bg-[var(--ns-raised)] p-[7px] shadow-[var(--ns-bezel),0_28px_56px_-32px_rgb(0_0_0/0.5)]">
        {/* the screen is its own stacking context, so the bar and the More sheet stay inside the phone */}
        <div className="relative isolate flex h-[548px] flex-col overflow-hidden rounded-[37px] bg-[var(--ns-canvas)] shadow-[inset_0_0_0_1px_var(--ns-line)]">
          <div aria-hidden className="mx-auto mt-2.5 h-[22px] w-[84px] shrink-0 rounded-full bg-[#0b0b0c]" />
          <div ref={screen} className="flex min-h-0 flex-1 flex-col px-5 pt-4">
            <h3 className="m-0 mb-3 font-[family-name:var(--ns-font-display)] text-[22px] leading-tight font-[number:var(--ns-weight-strong)] tracking-[-0.02em] text-[var(--ns-ink)]">{title[on]}</h3>
            <Screen tab={on} unread={unread} />
          </div>
          <div ref={setLayer} data-ns-stage-layer="" className={stageLayerClass} />
          {layer && (
            <StageLayer value={layer}>
              <PhoneTabBar
                className="absolute inset-x-0 bottom-0 flex pb-4"
                current={on}
                tabs={tabs}
                more={(close) => (
                  <>
                    <SheetItem icon={<Settings />} onClick={() => (close(), go("more"))}>
                      {labels.more}
                    </SheetItem>
                    <SheetItem icon={<Bell />} onClick={() => (close(), go("more"))}>
                      {labels.notifications}
                    </SheetItem>
                    <SheetItem icon={<CircleHelp />} onClick={() => (close(), go("more"))}>
                      {labels.help}
                    </SheetItem>
                  </>
                )}
              />
            </StageLayer>
          )}
        </div>
      </div>
    </div>
  );
}
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `tabs` | `PhoneTab[]` |  | Required. |
| `current` | `string \| undefined` |  | The key of the tab you're on, "more" for a page in the More sheet, or nothing. |
| `more` | `(close: () => void) => React.ReactNode` |  | The More sheet's rows; `close` shuts the sheet (call it before going somewhere). Leave out for no More. |
| `action` | `{ label: string; icon: React.ReactNode; onClick: () => void; /** a longer name for a screen reader */ aria?: string \| undefined }` |  | The app's one action, the bar's last slot (Health's + Log). |
| `labels` | `Partial<PhoneTabBarLabels>` |  | its built-in words (PHONE_TAB_BAR_LABELS) |
| `locale` | `string` |  | the locale a badge's count is written in (en-US unless the app passes another) |
| `onFeedback` | `(e: FeedbackEvent) => void` |  | called once per move, for your sound or haptics |

Full docs: https://notchset.dev/components/phone-tab-bar

## Customising
- Colours: every part reads the foundation's roles (`--ns-canvas`, `--ns-ink`, `--ns-line`, `--ns-signal` …), which read your shadcn tokens (`--background`, `--foreground`, `--border`, `--destructive` …), plus the optional `--success` and `--warning`. Retheme on `:root` or any container; never add Tailwind colour classes inside the component.
- Dark mode follows the `.dark` class or `data-theme="dark"` on an ancestor (the shadcn and next-themes conventions).
- Update later: Commit or stash local changes first (or copy the files), so the update can be undone. Read https://notchset.dev/r/changelog.json for the new versions: a major version, an entry marked breaking or a merge says what to change. Then re-run the install with `--overwrite`, on a branch. It replaces the component's files, the shared helper files they import, and the item's CSS rules in the global stylesheet, so review the whole diff (components, shared files, CSS), re-apply your own edits, and run the app's typecheck, tests and build.

## Responsive

- phone only
- dark (tokens)
- reduced motion: the pill lands at once

## Motion inventory

| Interaction | What moves |
|---|---|
| pill glides to the current tab | transform and width, --ns-time-panel, --ns-ease-move (glideMark). Reduced motion: lands at once (data-ns-glide). |
| press dips the icon | scale, --ns-time-quick, --ns-ease. Reduced motion: dips as it is (a press, not travel). |
| a badge pops in | ns-pop, --ns-time-toast, --ns-ease-pop. Reduced motion: shows at once, no pop (data-ns-still). |

## Accessibility contract (preserve when editing)
- A nav named Sections; the current tab carries aria-current=page; badges are images named (3 unread, Needs you); More says it opens a dialog and the sheet returns focus to it; the action takes a longer screen-reader name; the glide lands at once for reduced motion.

## Install

```bash
# npm
npx shadcn@latest add https://notchset.dev/r/phone-tab-bar.json
# pnpm
pnpm dlx shadcn@latest add https://notchset.dev/r/phone-tab-bar.json
# yarn
yarn dlx shadcn@latest add https://notchset.dev/r/phone-tab-bar.json
# bun
bunx --bun shadcn@latest add https://notchset.dev/r/phone-tab-bar.json
```

Or add the `@notchset` registry to components.json and run `npx shadcn@latest add @notchset/phone-tab-bar`. Every components.json style gets the same files.

### Manual

1. Install the packages: `npm install lucide-react@^1`.
2. Copy `components/ui/notchset/phone-tab-bar.tsx`, `lib/notchset/count.ts`, `lib/notchset/feedback.ts`, `lib/notchset/glide.ts`, `lib/notchset/icons.ts`, `lib/notchset/motion.ts`, `lib/notchset/words.ts` from https://notchset.dev/r/phone-tab-bar.json (each file's `content`, at its `target`), keeping the `@/` path alias of your tsconfig.
3. Add what it builds on: shadcn `utils` (cn), `notchset-foundation`, `bottom-sheet`.

## Continue the workflow

- [Sidebar](https://notchset.dev/blocks/sidebar)

## Source

### components/ui/notchset/phone-tab-bar.tsx

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { Ellipsis } from "@/lib/notchset/icons";
import { cn } from "@/lib/utils";
import { BottomSheet } from "@/components/ui/notchset/bottom-sheet";
import { glideMark, useGlide } from "@/lib/notchset/glide";
import { lessMotion } from "@/lib/notchset/motion";
import { badgeCount, formatTally } from "@/lib/notchset/count";
import { fill } from "@/lib/notchset/words";
import type { FeedbackProps } from "@/lib/notchset/feedback";

/*
 * Phone tab bar: an app's four or five sections a thumb reaches, docked at the foot of a phone and frosted so the
 * page shows through, clearing the home indicator. One raised pill glides to the tab you're on (the same mark the
 * sidebar and tabs use), unread shows as a count (Inbox 3) and a dot means something needs you. At rest the pill is
 * soft, a quiet wash with no shadow; only while it travels to the next tab does it lift (the raised surface, the lift
 * shadow, a step up), and it settles flat as it lands. The old tab's label goes quiet first and the new one lands in
 * ink after it, so the eye follows one thing. More opens a sheet with every other page, and lights while you're on
 * one of them. The app's one action (Health's + Log) is the bar's last slot: a round ink key standing a step above the
 * bar's edge, sinking when pressed. Less motion: the pill jumps flat and the labels swap at once.
 *
 *   <PhoneTabBar tabs={[{ key: "inbox", label: "Inbox", icon: <Inbox />, href: "#/inbox", badge: 3 }, …]} current="inbox"
 *     more={(close) => <SheetItem onClick={() => (close(), go("settings"))}>Settings</SheetItem>} />
 */
export type PhoneTab = {
  key: string;
  label: string;
  icon: React.ReactNode;
  /** Where the tab goes; a tab with no page (Search) takes onClick instead. */
  href?: string | undefined;
  onClick?: (() => void) | undefined;
  /** A count (unread), "dot" (something new) or "warn" (something needs you). */
  badge?: number | "dot" | "warn" | undefined;
};
type PhoneTabBarProps = {
  tabs: PhoneTab[];
  /** The key of the tab you're on, "more" for a page in the More sheet, or nothing. */
  current: string | undefined;
  /** The More sheet's rows; `close` shuts the sheet (call it before going somewhere). Leave out for no More. */
  more?: ((close: () => void) => React.ReactNode) | undefined;
  /** The app's one action, the bar's last slot (Health's + Log). */
  action?: { label: string; icon: React.ReactNode; onClick: () => void; /** a longer name for a screen reader */ aria?: string | undefined } | undefined;
  /** its built-in words (PHONE_TAB_BAR_LABELS) */
  labels?: Partial<PhoneTabBarLabels> | undefined;
  /** the locale a badge's count is written in (en-US unless the app passes another) */
  locale?: string | undefined;
  className?: string | undefined;
} & FeedbackProps;

const tab =
  "group relative z-1 flex min-h-13 min-w-0 flex-1 cursor-pointer flex-col items-center justify-center gap-0.5 rounded-[var(--ns-radius-lg)] px-0.5 text-center text-[length:var(--ns-text-meta)] leading-tight font-[number:var(--ns-weight-medium)] text-[var(--ns-ink-3)] no-underline outline-hidden focus-visible:outline-2 focus-visible:outline-[var(--ns-signal)]";
/* the label: the leaving one goes quiet at once; the arriving one lands in ink a beat later, after the old has left */
const word =
  "max-w-full truncate [transition:color_var(--ns-time-quick)_var(--ns-ease)] group-aria-[current=page]:text-[var(--ns-ink)] group-aria-[current=page]:[transition:color_var(--ns-time-color)_var(--ns-ease)_var(--ns-time-quick)] motion-reduce:[transition:none]! motion-reduce:group-aria-[current=page]:[transition:none]!";
const pill = "relative grid h-7 w-11 shrink-0 place-items-center rounded-full [transition:scale_var(--ns-time-quick)_var(--ns-ease)] group-active:scale-92 [&>svg]:size-5";

/** The bar's words, over the English defaults: the badges read aloud (`{count}` is the figure), the bar and More. */
const PHONE_TAB_BAR_LABELS = { needsYou: "Needs you", fresh: "New", unread: "{count} unread", sections: "Sections", more: "More" };
type PhoneTabBarLabels = typeof PHONE_TAB_BAR_LABELS;

function Badge({ badge, L, locale }: { badge: PhoneTab["badge"]; L: PhoneTabBarLabels; locale: string | undefined }) {
  if (badge === undefined) return null;
  if (badge === "dot" || badge === "warn")
    return <i role="img" aria-label={badge === "warn" ? L.needsYou : L.fresh} data-slot="phone-tab-badge" className={cn("absolute top-0.5 start-[calc(50%+6px)] size-2 rounded-full shadow-[0_0_0_2px_var(--ns-panel)]", badge === "warn" ? "bg-[var(--ns-warn)]" : "bg-[var(--ns-signal)]")} />;
  /* nothing for zero or a negative count, 99+ past 99 (count.ts) */
  const shown = badgeCount(badge);
  if (shown === null) return null;
  return (
    <i role="img" aria-label={fill(L.unread, { count: formatTally(badge, locale) })} data-slot="phone-tab-badge" data-ns-still="" className="absolute -top-1.5 start-[calc(50%+4px)] h-4.5 min-w-4.5 rounded-full bg-[var(--ns-signal)] px-1 text-center font-[family-name:var(--ns-font-display)] text-[length:var(--ns-text-meta)] leading-4.5 font-[number:var(--ns-weight-strong)] text-[var(--ns-canvas)] not-italic tabular-nums shadow-[0_0_0_2px_var(--ns-panel)] [animation:ns-pop_var(--ns-time-toast)_var(--ns-ease-pop)]">
      {shown}
    </i>
  );
}

function PhoneTabBar({ tabs, current, more, action, labels, locale, className, onFeedback }: PhoneTabBarProps) {
  const L = { ...PHONE_TAB_BAR_LABELS, ...labels };
  const [open, setOpen] = React.useState(false);
  const bar = React.useRef<HTMLElement>(null);
  useGlide(bar, (b) => b.querySelector<HTMLElement>('[aria-current="page"] [data-pill]'), [current, tabs.length, !!more, !!action]);
  /* the pill lifts only while it travels: from a new current until its glide lands */
  const [travel, setTravel] = React.useState(false);
  const was = React.useRef(current);
  React.useEffect(() => {
    if (was.current === current) return;
    const from = was.current;
    was.current = current;
    if (from === undefined || current === undefined || lessMotion(bar.current)) return;
    setTravel(true);
    /* a glide that never runs (a hidden bar) still sets the pill down */
    const t = setTimeout(() => setTravel(false), 700);
    return () => clearTimeout(t);
  }, [current]);
  React.useEffect(() => {
    const mark = bar.current?.querySelector<HTMLElement>(":scope > [data-glide]");
    if (!mark) return;
    const end = (e: TransitionEvent) => e.target === mark && e.propertyName === "transform" && setTravel(false);
    mark.addEventListener("transitionend", end);
    mark.addEventListener("transitioncancel", end);
    return () => {
      mark.removeEventListener("transitionend", end);
      mark.removeEventListener("transitioncancel", end);
    };
  }, []);
  /* while the bar shows (a phone), the app's root carries its height with the safe area as --ns-dock-bottom, so
     what floats at the foot (the Toaster) sits above it; the bar's own box already includes the inset */
  React.useEffect(() => {
    const el = bar.current;
    if (!el) return;
    const root = el.ownerDocument.documentElement;
    const set = () => {
      const h = el.offsetHeight;
      /* only a docked bar: one placed in a page (a demo) covers nothing */
      if (h > 0 && getComputedStyle(el).position === "fixed") root.style.setProperty("--ns-dock-bottom", `${h}px`);
      else root.style.removeProperty("--ns-dock-bottom");
    };
    set();
    /* the bar showing or hiding (display none at a wider width) resizes it to or from nothing */
    const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(set);
    ro?.observe(el);
    return () => {
      ro?.disconnect();
      root.style.removeProperty("--ns-dock-bottom");
    };
  }, []);
  return (
    <>
      <nav
        ref={bar}
        aria-label={L.sections}
        data-slot="phone-tab-bar"
        className={cn(
          "fixed inset-x-0 bottom-0 z-[var(--ns-layer-bar)] hidden border-t border-[var(--ns-line)] bg-[color-mix(in_oklab,var(--ns-panel)_84%,transparent)] px-[max(8px,env(safe-area-inset-left,0px))] pt-1 pb-[max(4px,env(safe-area-inset-bottom,0px))] backdrop-blur-md backdrop-saturate-150 phone:flex",
          className,
        )}
      >
        {/* the one mark behind the current tab's icon: soft and flat at rest; raised, shadowed and a step up only while it travels */}
        <i
          aria-hidden
          data-glide=""
          data-ns-glide=""
          data-travel={travel || undefined}
          className={cn(
            glideMark,
            "rounded-full bg-[color-mix(in_oklab,var(--ns-ink)_8%,transparent)] opacity-0 [box-shadow:0_0_0_0_transparent,0_0_0_0_transparent] [translate:0_0] [scale:1]",
            "[transition:transform_var(--ns-time-panel)_var(--ns-ease-move),width_var(--ns-time-panel)_var(--ns-ease-move),opacity_var(--ns-time-color),background-color_var(--ns-time-quick),box-shadow_var(--ns-time-quick),translate_var(--ns-time-quick)_var(--ns-ease),scale_var(--ns-time-quick)_var(--ns-ease)]",
            "data-[travel]:bg-[var(--ns-raised)] data-[travel]:[box-shadow:var(--ns-bezel),var(--ns-shadow-float)] data-[travel]:[translate:0_-4px] data-[travel]:[scale:1.1]",
          )}
        />
        {tabs.map((t) => {
          const inner = (
            <>
              {/* the badge sits on the icon's top-right corner, inside the pill, so every slot lines up the same */}
              <span data-pill="" className={pill}>
                {t.icon}
                <Badge badge={t.badge} L={L} locale={locale} />
              </span>
              {/* one line, always: a two-word name ("My work") ends in an ellipsis before it wraps under the row */}
              <span className={word}>{t.label}</span>
            </>
          );
          const cur = current === t.key ? "page" : undefined;
          const go = () => (t.onClick?.(), cur || onFeedback?.("select"));
          return t.href ? (
            <a key={t.key} href={t.href} onClick={go} aria-current={cur} className={tab}>
              {inner}
            </a>
          ) : (
            <button key={t.key} type="button" onClick={go} aria-current={cur} className={tab}>
              {inner}
            </button>
          );
        })}
        {more && (
          <button type="button" aria-haspopup="dialog" aria-current={current === "more" ? "page" : undefined} onClick={() => (setOpen(true), onFeedback?.("open"))} className={tab}>
            <span data-pill="" className={pill}>
              <Ellipsis />
            </span>
            <span className={word}>{L.more}</span>
          </button>
        )}
        {action && (
          /* raised: the app's one action stands a step above the bar's edge, a round ink key that sinks when pressed */
          <button type="button" data-slot="phone-tab-action" aria-label={action.aria ?? action.label} onClick={() => (action.onClick(), onFeedback?.("press"))} className={cn(tab, "justify-end")}>
            <span className="relative -mt-6 grid size-12 place-items-center rounded-full bg-[var(--ns-ink)] text-[var(--ns-canvas)] shadow-[var(--ns-lift),0_0_0_4px_var(--ns-canvas)] [transition:scale_var(--ns-time-quick)_var(--ns-ease),translate_var(--ns-time-quick)_var(--ns-ease),box-shadow_var(--ns-time-quick)] group-hover:[translate:0_-1px] group-active:[translate:0_1px] group-active:scale-94 group-active:shadow-[var(--ns-bezel),0_0_0_4px_var(--ns-canvas)] motion-reduce:[transition:none] [&>svg]:size-5.5">
              {action.icon}
            </span>
            <span className="mt-0.5 max-w-full truncate">{action.label}</span>
          </button>
        )}
      </nav>
      {more && (
        <BottomSheet open={open} onOpenChange={setOpen} title={L.more}>
          {more(() => setOpen(false))}
        </BottomSheet>
      )}
    </>
  );
}

export { PHONE_TAB_BAR_LABELS, PhoneTabBar, type PhoneTabBarLabels, type PhoneTabBarProps };
```

### lib/notchset/count.ts

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
/*
 * How a count is written, the one copy every piece reads: grouped the
 * same way everywhere (4,812,350), and a badge caps at 99+. A count is never negative: a negative badge, or zero,
 * shows nothing, and a negative count beside a label is written as 0.
 */
import { DEFAULT_LOCALE, formatCount as formatFigure } from "@/lib/notchset/words";

/** A count beside a label (a tab, a segment, a filter option, a section heading): 4812350 → "4,812,350", in `locale`. */
export function formatTally(n: number, locale: string = DEFAULT_LOCALE): string {
  return formatFigure(Number.isFinite(n) ? Math.max(0, Math.round(n)) : 0, locale, { maximumFractionDigits: 0 });
}

/** A badge's figure: nothing for zero or less, the count up to 99, then "99+". */
export function badgeCount(n: number | undefined | null): string | null {
  if (n == null || !Number.isFinite(n) || n <= 0) return null;
  return n > 99 ? "99+" : String(Math.round(n));
}
```

### lib/notchset/feedback.ts

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
export type FeedbackEvent = "press" | "toggle-on" | "toggle-off" | "open" | "close" | "select" | "success" | "error" | "add" | "remove" | "send";
export type FeedbackProps = {
  /** called once per move, for your sound or haptics */
  onFeedback?: ((e: FeedbackEvent) => void) | undefined;
};
```

### lib/notchset/glide.ts

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
"use client";
import * as React from "react";
import { EASE, lessMotion, roleTiming } from "@/lib/notchset/motion";

/* layout effects run as plain effects on the server, so React 18 server rendering stays silent */
const useIsomorphicLayoutEffect = typeof window === "undefined" ? React.useEffect : React.useLayoutEffect;

/*
 * The one moving mark a region has (the tab bar's pill, the sidebar's current page, the chosen tab): one element inside
 * `box`, marked `data-glide`, placed over the element `target` finds and moved to the next on `--ns-ease-move`. Its first
 * place is set without a move; it hides while nothing is current. `data-ns-glide` lands it at once with less motion.
 */
type Find = (box: HTMLElement) => HTMLElement | null | undefined;

/** Puts the mark on what `find` returns; `still` (or a first placing) lands it without a move. True once placed. */
function placeGlide(el: HTMLElement | null, find: Find, still: boolean, placed: boolean): boolean {
  const ind = el?.querySelector<HTMLElement>(":scope > [data-glide]");
  if (!el || !ind) return placed;
  const t = find(el);
  if (!t || t.getBoundingClientRect().height < 4) {
    ind.style.opacity = "0";
    return false;
  }
  const b = el.getBoundingClientRect(), r = t.getBoundingClientRect();
  /* boxes are measured on screen, the mark is placed in the box's own space: under a CSS zoom the two differ by it */
  const z = b.width > 0 && el.offsetWidth > 0 ? el.offsetWidth / b.width : 1;
  const x = (r.left - b.left) * z + el.scrollLeft - el.clientLeft, y = (r.top - b.top) * z + el.scrollTop - el.clientTop;
  const first = still || !placed;
  if (first) ind.style.transition = "none";
  ind.style.transform = `translate(${x}px, ${y}px)`;
  ind.style.width = `${r.width * z}px`;
  ind.style.height = `${r.height * z}px`;
  ind.style.opacity = "1";
  if (first) {
    void ind.offsetWidth;
    ind.style.transition = "";
  }
  return true;
}

export function useGlide(box: React.RefObject<HTMLElement | null>, target: Find, deps: React.DependencyList) {
  const placed = React.useRef(false);
  const find = React.useRef(target);
  useIsomorphicLayoutEffect(() => {
    find.current = target;
  });
  useIsomorphicLayoutEffect(() => {
    placed.current = placeGlide(box.current, find.current, false, placed.current);
  }, deps);
  React.useEffect(() => {
    const el = box.current;
    if (!el || typeof ResizeObserver === "undefined") return;
    const ro = new ResizeObserver(() => (placed.current = placeGlide(el, find.current, true, placed.current)));
    ro.observe(el);
    const watch = () => {
      for (const c of Array.from(el.children)) if (!c.hasAttribute("data-glide")) ro.observe(c);
    };
    watch();
    const again = () => (placed.current = placeGlide(el, find.current, false, placed.current));
    el.addEventListener("transitionend", again);
    const mo = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
      watch();
      again();
    });
    mo?.observe(el, { childList: true });
    return () => {
      ro.disconnect();
      mo?.disconnect();
      el.removeEventListener("transitionend", again);
    };
  }, [box]);
}

/** The indicator's own classes: absolutely placed at the box's origin, moving on the shared move curve. */
export const glideMark =
  "pointer-events-none absolute top-0 left-0 [transition:transform_var(--ns-time-panel)_var(--ns-ease-move),width_var(--ns-time-panel)_var(--ns-ease-move),height_var(--ns-time-panel)_var(--ns-ease-move),opacity_var(--ns-time-color)]";

/** A sort's glide: each row 240ms on the move curve, 12ms later than the row above it (by its new place), the
    stagger capped at 160ms. A row caught mid-glide carries on at once, from where it is seen. */
export const SORT_GLIDE = { time: 240, stagger: 12, cap: 160 } as const;

/* how far a row's running glide has it from its place now (0 at rest), read before its glide is cancelled */
function inFlight(r: HTMLElement): [number, number] | null {
  const runs = r.getAnimations?.() ?? [];
  if (!runs.length && !r.style.transform) return null;
  const t = getComputedStyle(r).transform;
  runs.forEach((a) => a.cancel());
  r.style.transform = "";
  if (!t || t === "none" || typeof DOMMatrixReadOnly === "undefined") return null;
  const m = new DOMMatrixReadOnly(t);
  return Math.abs(m.m41) < 0.5 && Math.abs(m.m42) < 0.5 ? null : [m.m41, m.m42];
}

/**
 * Rows that move glide there (FLIP, on the move curve): a new sort (`sortKey` changes) glides every row from where it
 * is seen to where it lands, 12ms apart by its new place (SORT_GLIDE), and rows taken away (a delete, a bulk move, a
 * chip or a file removed) close the gap rather than jumping. A second sort mid-glide carries each row on from where
 * it is on screen, with no stagger for a row already moving. Each row is an element under `box` matching `rows` with
 * a `data-row` id; less motion lands them at once. A row holding the focus keeps it. Only a removal or a sort moves
 * anything: a row arriving lands where it is, and so does a list shown another way (`view` changes). With `joins`, a
 * set that loses or takes rows, both in the same change too (an archive the next rows refill, an Undo), glides the
 * rows that stay from where they were last seen; the new ones land where they are.
 */
export function useRowGlide(box: React.RefObject<HTMLElement | null>, rows: string, order: string, sortKey = "", view = "", joins = false) {
  const places = React.useRef(new Map<string, readonly [number, number]>());
  const lastSort = React.useRef(sortKey);
  const lastView = React.useRef(view);
  useIsomorphicLayoutEffect(() => {
    const b = box.current;
    /* the box is gone (the list emptied): forget the places, so the next list never glides from stale ones */
    if (!b) return void places.current.clear();
    const els = [...b.querySelectorAll<HTMLElement>(rows)];
    const was = places.current;
    const sorted = lastSort.current !== sortKey;
    lastSort.current = sortKey;
    /* only rows left, none new: the list closed a gap */
    const viewed = lastView.current !== view;
    lastView.current = view;
    const closed = !sorted && !viewed && (joins ? els.some((r) => was.has(r.dataset.row!)) && (els.length !== was.size || els.some((r) => !was.has(r.dataset.row!))) : els.length < was.size && els.every((r) => was.has(r.dataset.row!)));
    const still = lessMotion(b);
    const next = new Map<string, readonly [number, number]>();
    els.forEach((r, i) => {
      /* where it sits in its list, not on screen: a scroll between two renders moves nothing */
      const at = [r.offsetLeft, r.offsetTop] as const;
      next.set(r.dataset.row!, at);
      const from = was.get(r.dataset.row!);
      if (!(sorted || closed) || from === undefined) return;
      /* seen = its old place plus how far along its glide it still was */
      const flying = inFlight(r);
      const dx = from[0] + (flying?.[0] ?? 0) - at[0], dy = from[1] + (flying?.[1] ?? 0) - at[1];
      if (still || (Math.abs(dx) < 1 && Math.abs(dy) < 1)) return;
      const go = dx ? `translate(${dx}px, ${dy}px)` : `translateY(${dy}px)`;
      const timing: KeyframeAnimationOptions = sorted
        ? { duration: SORT_GLIDE.time, delay: flying ? 0 : Math.min(i * SORT_GLIDE.stagger, SORT_GLIDE.cap), easing: EASE.move, fill: "backwards" }
        : { ...roleTiming(r, "--ns-time-panel"), easing: EASE.move };
      r.animate?.([{ transform: go }, { transform: "none" }], timing);
    });
    places.current = next;
  }, [box, rows, order, sortKey, view, joins]);
}
```

### lib/notchset/icons.ts

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
/** Every piece imports its icons from here: swap the icon set in this one file. */
export * from "lucide-react";
```

### lib/notchset/motion.ts

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
"use client";
/*
 * Less motion, the one switch every piece reads, and a motion role's timing for a Web Animation. Split from
 * physics.ts so a piece that needs only these does not carry the springs.
 */
import * as React from "react";

/**
 * Less motion where `el` sits: the device's setting, then a data-motion="reduced" on `el` or any ancestor, falling
 * back to <html>'s when there is no element. The one copy: every piece reads this.
 */
const REDUCED = '[data-motion="reduced"],[data-motion="off"]';
export function lessMotion(el?: Element | null): boolean {
  if (typeof document === "undefined") return true;
  if (typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches) return true;
  return !!(el?.closest?.(REDUCED) ?? document.documentElement.matches(REDUCED));
}

/** Less motion, kept current as the setting changes; true on a server, so a piece starts in its still. */
export function useLessMotion(): boolean {
  return React.useSyncExternalStore(
    (f) => {
      if (typeof matchMedia === "undefined") return () => {};
      const q = matchMedia("(prefers-reduced-motion: reduce)");
      q.addEventListener("change", f);
      const mo = typeof MutationObserver === "undefined" ? null : new MutationObserver(f);
      mo?.observe(document.documentElement, { attributes: true, attributeFilter: ["data-motion"] });
      return () => {
        q.removeEventListener("change", f);
        mo?.disconnect();
      };
    },
    () => lessMotion(),
    () => true,
  );
}

/** A motion role's duration and curve (0 under less motion: the result at once), read from the foundation where `el` sits, for a Web Animation that glides
    something CSS can't transition (a width to `auto`, a node on its way out): `roleTiming(el, "--ns-time-menu")`. */
export function roleTiming(el: Element, time: string, ease = "--ns-ease"): KeyframeAnimationOptions {
  if (lessMotion(el)) return { duration: 0, easing: "linear" };
  const cs = getComputedStyle(el);
  const t = cs.getPropertyValue(time).trim();
  const ms = t.endsWith("ms") ? parseFloat(t) : parseFloat(t) * 1000;
  return { duration: Number.isFinite(ms) ? ms : 0, easing: cs.getPropertyValue(ease).trim() || "linear" };
}

/** The foundation's curves as literal strings, for a Web Animation (`element.animate`, `KeyframeEffect`,
    `updateTiming`): those take a literal easing and throw on a CSS var. Copied from foundation.css's `--ns-ease-*`;
    CSS transitions and keyframes keep the vars. */
export const EASE = {
  enter: "cubic-bezier(0.22, 1, 0.36, 1)",
  move: "cubic-bezier(.5, 0, .2, 1)",
  exit: "cubic-bezier(.6, 0, .9, .5)",
  panel: "cubic-bezier(0.32, 0.72, 0, 1)",
  press: "cubic-bezier(0.2, 0, 0, 1)",
  spring: "cubic-bezier(0.16, 1, 0.3, 1)",
  arrive: "cubic-bezier(.3, 1.22, .5, 1)",
  breathe: "cubic-bezier(.45, 0, .55, 1)",
} as const;
```

### lib/notchset/words.ts

```tsx
// Notchset phone-tab-bar 1.1.0 · https://notchset.dev/changelog
import * as React from "react";

/* Built-in words and figures, one way for every piece. */

/** The locale a piece writes in when the app passes none: English at launch, the same on the server and in the browser. */
export const DEFAULT_LOCALE = "en-US";

/** A count's words by the locale's plural rule: `other` always, any of the locale's other forms as it needs them. */
export type Plural = { other: string } & Partial<Record<Intl.LDMLPluralRule, string>>;

/** A whole number (or any figure) in the locale's digits and grouping. */
export function formatCount(n: number, locale: string = DEFAULT_LOCALE, options?: Intl.NumberFormatOptions): string {
  return new Intl.NumberFormat(locale, options).format(n);
}

/** A sentence with its `{name}` blanks filled; a blank with no value is left as written. */
export function fill(sentence: string, vars: Readonly<Record<string, string | number>>): string {
  return sentence.replace(/\{(\w+)\}/g, (blank, name: string) => (name in vars ? String(vars[name]) : blank));
}

/** The same, where a blank is a node (a name in ink): the sentence's own words stay in order around it. */
export function fillNodes(sentence: string, vars: Readonly<Record<string, React.ReactNode>>): React.ReactNode {
  return sentence.split(/(\{\w+\})/).map((part, i) => {
    const name = /^\{(\w+)\}$/.exec(part)?.[1];
    return name !== undefined && name in vars ? React.createElement(React.Fragment, { key: i }, vars[name]) : part;
  });
}

/** A count's sentence by the locale's plural rule, `{count}` written in the locale ("1 message", "4 messages"). */
export function plural(locale: string | undefined, n: number, forms: Plural, vars: Readonly<Record<string, string | number>> = {}): string {
  const loc = locale ?? DEFAULT_LOCALE;
  const rule = new Intl.PluralRules(loc).select(n);
  return fill(forms[rule] ?? forms.other, { count: formatCount(n, loc), ...vars });
}
```

The foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://notchset.dev/r/notchset-foundation.json.
