Top Pages
1 バリエーションA sortable top pages table for web analytics, with share bars, row sparklines, and a detail view for each page.
Pages table
A sortable top pages table with tinted share bars behind each path, numbers that roll between 7d and 30d, and row sparklines. Clicking a row opens its daily trend, top referrers, and entry and exit rates.
Top pages
| Details | ||
|---|---|---|
| / | 38,420 | |
| /pricing | 21,960 | |
| /docs/getting-started | 17,340 | |
| /blog/edge-caching-notes | 14,870 | |
| /changelog | 11,200 | |
| /docs/api/events | 9,840 | |
| /integrations | 8,310 | |
| /signup | 7,650 |
1,284 pages · 412.3k views · avg 1m 42s
"use client";
import { TopPages } from "@/components/premium/top-pages";
export function TopPagesTablePreview() {
return (
<div className="w-full px-4 py-10">
<TopPages />
</div>
);
}
インストール
API リファレンス
必須と記された props 以外はすべて省略できます。データ、文言、色はサンプルの内容が既定値です。
TopPages15 個の props
pagesPages with their numbers for every period.
TopPage[]既定値
build()periodsPeriods for the tabs; ids key each page's `stats` and `totals`.
TopPagesPeriod[]periodControlled period id.
stringdefaultPeriodPeriod id when uncontrolled; defaults to the first period.
stringonPeriodChangeCalled when a period tab is chosen.
((period: string) => void)totalsSite totals per period id for the footer line.
Record<string, TopPagesTotals>endDateISO date of each period's last day, for the trend readout.
string既定値
2026-11-28defaultSortStarting sort.
TopPagesSortpageSizeRows per table page.
number既定値
8colorsBar, chart and accent color classes; anything left out keeps its default.
Partial<TopPagesColors>bounceBandsBounce rate bands for the good, fair and bad colors.
TopPagesBounceBandstoneClassNamesText color per bounce band; anything left out keeps its default.
Partial<TopPagesToneClassNames>formattersFormatter overrides; anything left out uses the defaults.
Partial<TopPagesFormatters>labelsCopy overrides; anything left out uses the English defaults.
Partial<TopPagesLabels>classNameClasses merged onto the root element.
string
PageDetail8 個の props
stats必須Numbers for the expanded page in the selected period.
TopPageStatsendDate必須ISO date of the period's last day.
stringlabels必須Copy for headings and captions.
TopPagesLabelsformatters必須Number, duration and rate formatters.
TopPagesFormatterscolors必須Chart and bar colors.
PageDetailColorsbounceBands必須Bounce rate bands for the narrow-width stats.
TopPagesBounceBandstoneClassNames必須Text color per bounce band.
TopPagesToneClassNamesreduce必須Skip movement, keep fades.
boolean
PageRow16 個の props
page必須The page.
TopPagestats必須Its numbers for the selected period.
TopPageStatsperiod必須Selected period id; the sparkline redraws when it changes.
stringshare必須Share bar width, views over the period's top page, 0 to 1.
numberexpanded必須Whether the detail below is open.
booleanonToggle必須Called to open or close the detail.
() => voiddetailId必須Id of the detail row, for `aria-controls`.
stringdelay必須Entrance delay in seconds; 0 for rows that arrive later.
numberlabels必須Copy for the expand button.
TopPagesLabelsformatters必須Number, duration and rate formatters.
TopPagesFormattersbarClassName必須Share bar class, such as `bg-sky-500/15`.
stringsparklineClassName必須Sparkline stroke class, such as `stroke-sky-500`.
stringbounceBands必須Bounce rate bands.
TopPagesBounceBandstoneClassNames必須Text color per bounce band.
TopPagesToneClassNamesreduce必須Skip movement, keep fades.
booleanrefThe row element, so AnimatePresence can pop exiting rows out of the flow.
Ref<HTMLTableRowElement>
PageTrend9 個の props
values必須Views per day, oldest first.
number[]endDate必須ISO date of the last value.
stringtitle必須Heading above the chart, such as "Daily views".
stringunit必須Unit after the readout number, such as "views".
stringformatters必須Count and day formatters for the readout.
Pick<TopPagesFormatters, "count" | "day">strokeClassName必須Line color class, such as `stroke-sky-500`.
stringfillClassName必須Area color class, such as `fill-sky-500/15`.
stringdotClassName必須Dot color class for the hovered day, such as `bg-sky-500`.
stringreduce必須Skip the wipe and movement.
boolean
SortHeader7 個の props
column必須Column this header sorts.
"path" | "views" | "visitors" | "avgSeconds" | "bounceRate"label必須Header text.
stringsort必須Current sort.
TopPagesSortonSort必須Called with the column when the header is pressed.
(key: TopPagesSortKey) => voidnumericRight-align the label, for number columns.
boolean既定値
falsereduce必須Skip the chevron turn.
booleanclassNameWidth and visibility classes for the cell.
string
TopPagesEmpty4 個の props
title必須Title under the illustration.
stringhint必須Hint under the title.
stringaccentClassNameAccent class for the lens, such as `text-sky-500`.
string既定値
text-sky-500reduce必須Skip movement, keep fades.
boolean
TopPagesFooter9 個の props
totalsSite totals for the selected period, or undefined to hide the line.
TopPagesTotalsfrom必須First row shown, 1-based; 0 when nothing matches.
numberto必須Last row shown.
numbertotal必須Rows after filtering.
numberpage必須Current page, 0-based.
numberpageCount必須Number of pages.
numberonPageChange必須Called with the page to show.
(page: number) => voidlabels必須Copy for totals and pagination.
TopPagesLabelsformatters必須Number and duration formatters.
TopPagesFormatters
TopPagesHeader6 個の props
query必須Search text.
stringonQueryChange必須Called as the search text changes.
(query: string) => voidperiods必須Periods for the tabs.
TopPagesPeriod[]period必須Selected period id.
stringonPeriodChange必須Called when a period tab is chosen.
(period: string) => voidlabels必須Copy for the title, search and tabs.
TopPagesLabels
TopPagesTable16 個の props
rows必須Rows on the current page, already sorted.
TopPagesViewRow[]period必須Selected period id.
stringendDate必須ISO date of the period's last day.
stringmaxViews必須Largest view count in the period, for share bars.
numbersort必須Current sort.
TopPagesSortonSort必須Called when a header is pressed.
(key: TopPagesSortKey) => voidexpandedId必須Id of the expanded page, or null.
string | nullonExpandedChange必須Called to open (id) or close (null) a row's detail.
(id: string | null) => voidcascade必須Stagger rows in; true only for the first rows after mount.
booleanlabels必須Copy for headings and buttons.
TopPagesLabelsformatters必須Number, duration and rate formatters.
TopPagesFormatterscolors必須Bar, chart and sparkline colors.
PageDetailColors & { sparkline: string; }bounceBands必須Bounce rate bands.
TopPagesBounceBandstoneClassNames必須Text color per bounce band.
TopPagesToneClassNamesempty必須Shown in place of rows when nothing matches.
ReactNodereduce必須Skip movement, keep fades.
boolean
useTopPagesView6 個の props
pages必須Every page with its stats per period.
TopPage[]period必須Period whose stats are shown.
stringquery必須Search text that filters paths.
stringsort必須Column and direction to sort by.
TopPagesSortpage必須Zero-based page of results.
numberpageSize必須Rows per page.
number
型13 個の型
これらの props が受け取るオブジェクト型とそのフィールド。
TopPagesColors6 個のフィールド
bar必須Share bar behind paths and referrers.
stringsparkline必須Row sparkline stroke.
stringstroke必須Detail trend line stroke.
stringfill必須Detail trend area fill.
stringdot必須Hovered-day dot on the trend.
stringaccent必須Empty-state lens text color.
string
TopPagesSort2 個のフィールド
key必須Column the rows are ordered by.
TopPagesSortKeydirection必須`desc` puts the largest value (or Z for paths) first.
"asc" | "desc"
TopPagesPeriod2 個のフィールド
id必須Stable id, used as the key into each page's `stats`.
stringlabel必須Tab text, such as "7d".
string
TopPage3 個のフィールド
id必須Stable id.
stringpath必須URL path shown in mono, such as "/pricing".
stringstats必須Numbers keyed by period id. Pages missing a period are hidden in it.
Record<string, TopPageStats>
TopPagesTotals3 個のフィールド
pages必須Pages with at least one view in the period.
numberviews必須All page views in the period.
numberavgSeconds必須Average time on page across the site, in seconds.
number
TopPagesLabels28 個のフィールド
title必須Card title.
stringsearch必須Search field placeholder.
stringsearchLabel必須Accessible name of the search field.
stringperiods必須Accessible name of the period tabs.
stringpage必須Page column heading.
stringviews必須Views column heading.
stringvisitors必須Visitors column heading.
stringavgTime必須Average time column heading.
stringbounceRate必須Bounce rate column heading.
stringtrend必須Trend column heading.
stringtable必須Accessible name of the table.
stringdetails必須Screen-reader heading of the expand column.
stringexpand必須Expand button label; receives the path.
(path: string) => stringcollapse必須Collapse button label; receives the path.
(path: string) => stringshow必須Expand button tooltip.
stringhide必須Collapse button tooltip.
stringdailyViews必須Detail chart heading.
stringreferrers必須Detail referrers heading.
stringentryRate必須Entry rate caption.
stringexitRate必須Exit rate caption.
stringemptyTitle必須Empty-search title.
stringemptyHint必須Empty-search hint; receives the query.
(query: string) => stringpages必須Footer word after the page total.
stringviewsTotal必須Footer word after the view total.
stringavg必須Footer word before the average time.
stringprevious必須Previous page button label.
stringnext必須Next page button label.
stringrange必須Range text, such as "1–8 of 24".
(from: number, to: number, total: number) => string
TopPagesFormatters5 個のフィールド
count必須Full counts in cells and readouts, such as "21,960".
(value: number) => stringcompact必須Short counts in the footer, such as "412k".
(value: number) => stringduration必須Seconds as a duration, such as "1m 42s".
(seconds: number) => stringpercent必須A 0 to 100 rate, such as "38%".
(value: number) => stringday必須A day in the trend readout, such as "Nov 24".
(date: Date) => string
TopPagesBounceBands2 個のフィールド
good必須Highest rate still shown as good.
numberbad必須Lowest rate shown as bad.
number
TopPagesToneClassNames3 個のフィールド
good必須Rates at or under the good band.
stringfair必須Rates between the bands.
stringbad必須Rates at or over the bad band.
string
TopPageStats8 個のフィールド
views必須Page views in the period.
numbervisitors必須Unique visitors in the period.
numberavgSeconds必須Average time on page, in seconds.
numberbounceRate必須Share of single-page sessions that started here, 0 to 100.
numberentryRate必須Share of sessions that started on this page, 0 to 100.
numberexitRate必須Share of sessions that ended on this page, 0 to 100.
numberdaily必須Views per day, oldest first; the last value is the period's end date.
number[]referrers必須Top sources for this page, largest first. The detail shows the first three.
TopPageReferrer[]
PageDetailColors4 個のフィールド
bar必須Share bar class behind referrer names, such as `bg-sky-500/15`.
stringstroke必須Trend line class, such as `stroke-sky-500`.
stringfill必須Trend area class, such as `fill-sky-500/15`.
stringdot必須Hovered-day dot class, such as `bg-sky-500`.
string
TopPagesViewRow2 個のフィールド
page必須The page.
TopPagestats必須Its numbers for the selected period.
TopPageStats
TopPageReferrer2 個のフィールド
name必須Source name, such as "google.com" or "Direct".
stringvisits必須Visits from this source in the period.
number