OfferLifetime Pro for $99

Top Pages Table

Paths in mono with their title, visitors, a bar of each page's share of the traffic, and the change against last period, signed, with an arrow, and coloured last. A page with no traffic last period says New.

Data TablesBlockProLifetime access176 lines · one file

The decision inside it

Noise is not news

Changes under half a percent read 0% in the quiet tone, and a new page says New instead of an infinite percent, so the column only shouts when something moved.

When to use it

Use Top Pages Table in analytics for the most visited paths: visitors, share of traffic as a bar, and the signed change against the previous period. Pass previous counts; a page with none reads New.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Layro's Top Pages Table for this.
Install it: npx shadcn@latest add @layro/top-pages-table
(the @layro registry is set up in components.json, with LAYRO_KEY in .env.local)
Import it from @/components/ui/top-pages-table.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @layro registry with your CLI token: see the Namespaced tab.

Usage

components/top-pages.tsx
import { TopPagesTable, type PageStat } from "@/components/ui/top-pages-table";

export function TopPages({ rows }: { rows: PageStat[] }) {
  return <TopPagesTable rows={rows} compareLabel="vs last week" onRowClick={(p) => console.info("open", p.path)} />;
}

API reference

“Copy prompt” above puts a full brief on your clipboard — install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

PropTypeNotes
rowsrequiredPageStat[]—
compareLabelstringShown over the change column: "vs last week". Default "vs last week".
loadingboolean—
errorReact.ReactNode—
onRetry() => void—
onRowClick(row: PageStat) => void—
density"comfortable" | "compact"—
variant"default" | "striped" | "bordered"—
pageSizenumberRows per page. Default 10; 0 shows all.
classNamestring—

Dependencies

npm packages

clsxlucide-reacttailwind-merge

Layro foundations, installed alongside it

layro-themedata-table

States

All of them are drawn by the component. None is left for you to design.

  • By visitors
  • Rising and falling
  • New page
  • Loading
  • Empty
  • Error

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Lifetime access

Every component, and everything we ship next.

  • All 232 components, source included
  • Every template, and everything released after you buy
  • shadcn CLI or download — React 18/19, Tailwind v4
  • One payment. No subscription.