Page tabs

The PageTabs component under test: rhythm against the page's spacing, deep links between tabs, closed-tab crawler check and a row of nine tabs for overflow.

Using it

Each tab is an id, a label and its content. The ids end up in the URL hash.

tsx
import { PageTabs } from "@/components/site/page-tabs";

<PageTabs
  tabs={[
    { id: "overview", label: "Overview", children: <Overview /> },
    { id: "details", label: "Details", children: <Details /> },
  ]}
/>

Try it

The first tab, open by default. Switch tabs and watch the address bar: the hash follows.

Reload the page on another tab and it opens there.

The same blocks outside the tabs

For comparison with the Rhythm tab: the gaps should match.

A heading

A paragraph straight after the heading, then a list.

  • First item
  • Second item
ts
const sample = "a code block";
WhereSpacing between blocks
On the pagethe page's own flow rhythm
In a tabshould be the same

A last paragraph.

Many tabs

Narrow the window: the bar should scroll sideways instead of wrapping or overflowing the page.

This is the one tab. With this many, the bar has to scroll sideways on a phone.

Things to check

  • Crawlers. The Zebra-4 sentence should be in the page source even while its tab is closed.
  • Rhythm. The blocks in the tab and the same blocks below should have the same gaps.
  • Deep links. Load the page with #rhythm on the end and it should open on that tab. Back and forward shouldn't break it.
  • Two sets. Switching the lower set must not change the upper one.
  • Hidden headings. A heading inside a closed tab can't be scrolled to, so a contents link to it does nothing. Worth remembering before putting headings in tabs.
  • UI stress test

    Nested components stacked inside each other, like bold and code inside links and tables inside lists, to find where the styles break.

  • Table stress

    Tables with very wide cells, long unbroken words and many columns, to check how they scroll and wrap.

  • Code stress test

    Absurdly long identifiers, strings, paths, and files in inline code and code blocks.

  • Code blocks

    The VS Code-style code block: snippets, multi-file tabs, explorer, wrap, copy.