skip to content
mpkcn

~/components/tmux-bar

Tmux Bar

A tmux-style status bar with a session block, clickable windows, custom segments, a clock, uptime and scroll position.

$ pnpm dev
  ▲ ready on http://localhost:3000
  ✓ compiled in 412ms
[dev]
mainonline"mpkcn"up --:--

Installation

terminal
npx mpkcn add tmux-bar
deps:none beyond react· tested with react@19.3.0

Usage

A one-line status bar: session block and windows on the left, your segments and the clock on the right.

tsx
import { TmuxBar } from "@/components/mpkcn/tmux-bar";

export function Footer() {
  return <TmuxBar session="0" windows={["home", "docs", "blog"]} activeWindow={1} host="mysite.dev" />;
}

Windows show as 0:home 1:docs*, the active one marked with *. Give a window href to make it a link or onSelect to make it a button.

Examples

Pinned to the page

fixed docks it to the bottom of the viewport. scrollProgress adds how far the page is scrolled, uptime how long it has been open. Leave room at the bottom of your page (about 22px).

$ pnpm dev
  ▲ ready on http://localhost:3000
  ✓ compiled in 412ms
[dev]
mainonline"mpkcn"up --:----%

Status segments

segments are your own pieces on the right. live adds a pulsing square, tone picks a color, collapse hides it on narrow screens and onClick makes it a button. With timeZone and clockLabel the clock can show someone else's local time.

$ pnpm dev
  ▲ ready on http://localhost:3000
  ✓ compiled in 412ms
[dev]open to workreply < 24h"mpkcn"Tunis

Props

PropTypeDefaultDescription
sessionstring"0"Session name in the highlighted block.
windows(string | { label; href?; onSelect? })[]["zsh"]Windows listed after the session.
activeWindownumber0Index of the active window.
segments{ label; tone?; live?; collapse?; onClick?; ariaLabel? }[][]Your own segments on the right.
hoststring—Host name in quotes, like tmux's default.
clockbooleantrueShow a HH:MM clock.
timeZonestringvisitor's ownIANA time zone for the clock, e.g. "Africa/Tunis".
clockLabelstring—Text before the clock.
uptimebooleanfalseTime since the page opened.
scrollProgressbooleanfalseHow far the page is scrolled, in %.
fixedbooleanfalsePin it to the bottom of the viewport.
classNamestring—Extra classes for the bar.

Accessibility

  • Windows are a list labelled "Windows". The active one has aria-current; with href or onSelect they are real links or buttons with a visible focus ring.
  • The clock, uptime and scroll value are not live regions, so they never interrupt a screen reader.
  • They render --:-- on the server and fill in after mount, so there is no hydration mismatch.
  • The live square only pulses when motion is allowed.