All blocks
Analytics Dashboard
Three-band analytics screen: a multi-series active-sessions chart and KPI sparkline tiles, audience stacked bar cards, and supporting top-routes and top-interactions activity tables.
Dashboard
Active sessions
Weekly Active Users
64.8 k
+21.4%Last 14 days vs. prior period
Docs Page Views
142.6 k
+15.8%Last 14 days vs. prior period
Median Read Time
3.8 min
+6.2%Last 14 days vs. prior period
Exit Rate
34.1%
-5.4%Last 14 days vs. prior period
Audience
Geography
North America42%
Europe31%
Asia-Pacific18%
Latin America6%
Other3%
Discipline
Frontend48%
Full-Stack24%
Design Systems14%
Platform9%
Other5%
Activity
Top routes
All routes| Route | Views | New Visitors | Median Time |
|---|---|---|---|
| /blocks | 58.4% | 4:18 | |
| /components/button | 41.2% | 3:26 | |
| /components/dialog | 36.9% | 4:52 | |
| /components/combobox | 49.5% | 5:14 | |
| /blocks/dashboards | 64.1% | 3:49 | |
| /components/table | 33.7% | 5:05 | |
| /components/tabs | 44.0% | 2:47 | |
| /components/menu | 31.8% | 4:11 | |
| /blocks/ai | 68.2% | 4:36 | |
| /changelog | 24.6% | 3:12 |
Top interactions
All interactions| Interaction | Count | Users | New Users |
|---|---|---|---|
| copy_code | 14,620 | 5,380 | |
| engine_switch | 10,210 | 4,190 | |
| preview_interact | 8,940 | 3,610 | |
| cli_copy | 6,430 | 2,890 | |
| search_query | 4,720 | 1,940 | |
| theme_toggle | 3,890 | 1,420 | |
| block_fullscreen | 2,810 | 1,120 | |
| filter_category | 2,190 | 870 | |
| docs_export | 1,340 | 520 | |
| share_link | 890 | 340 |
Install
1npx stylexblocks add analytics-dashboardSource
components/blocks/ui-sdk/analytics-dashboard.tsx
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618import * as stylex from "@stylexjs/stylex";import { useMemo } from "react";import { Button } from "#components/ui/ui-sdk/button.tsx";import { Card } from "#components/ui/ui-sdk/card.tsx";import { CategoryBar, LineChart, Sparkline, type ChartColorName,} from "#components/ui/ui-sdk/chart.tsx";import { Grid } from "#components/ui/ui-sdk/grid.tsx";import { Heading } from "#components/ui/ui-sdk/heading.tsx";import { Link } from "#components/ui/ui-sdk/link.tsx";import { Progress } from "#components/ui/ui-sdk/progress.tsx";import { Separator } from "#components/ui/ui-sdk/separator.tsx";import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";import { Stat } from "#components/ui/ui-sdk/stat.tsx";import { Table } from "#components/ui/ui-sdk/table.tsx";import { Text } from "#components/ui/ui-sdk/text.tsx";import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";import { VisuallyHidden } from "#components/ui/ui-sdk/visually-hidden.tsx";import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";import { bluePalette } from "@stylexblocks/ui/themes/palettes.ts";import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";import type { StyleOverrideProps } from "#lib/recipe-props.ts";
interface ActiveSessionPoint { slot: number; label: string; total: number; web: number; mobile: number;}
const ACTIVE_SESSIONS_DATA: ActiveSessionPoint[] = [ { slot: 0, label: "Nov 18 09:00", total: 94, web: 64, mobile: 30 }, { slot: 1, label: "Nov 18 09:15", total: 98, web: 67, mobile: 31 }, { slot: 2, label: "Nov 18 09:30", total: 103, web: 71, mobile: 32 }, { slot: 3, label: "Nov 18 09:45", total: 107, web: 74, mobile: 33 }, { slot: 4, label: "Nov 18 10:00", total: 112, web: 78, mobile: 34 }, { slot: 5, label: "Nov 18 10:15", total: 118, web: 82, mobile: 36 }, { slot: 6, label: "Nov 18 10:30", total: 121, web: 84, mobile: 37 }, { slot: 7, label: "Nov 18 10:45", total: 125, web: 88, mobile: 37 }, { slot: 8, label: "Nov 18 11:00", total: 128, web: 90, mobile: 38 }, { slot: 9, label: "Nov 18 11:15", total: 126, web: 88, mobile: 38 }, { slot: 10, label: "Nov 18 11:30", total: 124, web: 86, mobile: 38 }, { slot: 11, label: "Nov 18 11:45", total: 120, web: 81, mobile: 39 }, { slot: 12, label: "Nov 18 12:00", total: 115, web: 74, mobile: 41 }, { slot: 13, label: "Nov 18 12:15", total: 111, web: 68, mobile: 43 }, { slot: 14, label: "Nov 18 12:30", total: 109, web: 64, mobile: 45 }, { slot: 15, label: "Nov 18 12:45", total: 112, web: 66, mobile: 46 }, { slot: 16, label: "Nov 18 13:00", total: 118, web: 71, mobile: 47 }, { slot: 17, label: "Nov 18 13:15", total: 123, web: 77, mobile: 46 }, { slot: 18, label: "Nov 18 13:30", total: 129, web: 84, mobile: 45 }, { slot: 19, label: "Nov 18 13:45", total: 132, web: 88, mobile: 44 }, { slot: 20, label: "Nov 18 14:00", total: 136, web: 93, mobile: 43 }, { slot: 21, label: "Nov 18 14:15", total: 138, web: 96, mobile: 42 }, { slot: 22, label: "Nov 18 14:30", total: 135, web: 94, mobile: 41 }, { slot: 23, label: "Nov 18 14:45", total: 131, web: 91, mobile: 40 }, { slot: 24, label: "Nov 18 15:00", total: 127, web: 87, mobile: 40 }, { slot: 25, label: "Nov 18 15:15", total: 124, web: 84, mobile: 40 }, { slot: 26, label: "Nov 18 15:30", total: 121, web: 81, mobile: 40 }, { slot: 27, label: "Nov 18 15:45", total: 118, web: 77, mobile: 41 }, { slot: 28, label: "Nov 18 16:00", total: 114, web: 72, mobile: 42 }, { slot: 29, label: "Nov 18 16:15", total: 110, web: 67, mobile: 43 }, { slot: 30, label: "Nov 18 16:30", total: 105, web: 61, mobile: 44 }, { slot: 31, label: "Nov 18 16:45", total: 101, web: 56, mobile: 45 }, { slot: 32, label: "Nov 18 17:00", total: 96, web: 50, mobile: 46 }, { slot: 33, label: "Nov 18 17:15", total: 92, web: 45, mobile: 47 }, { slot: 34, label: "Nov 18 17:30", total: 88, web: 41, mobile: 47 }, { slot: 35, label: "Nov 18 17:45", total: 85, web: 39, mobile: 46 }, { slot: 36, label: "Nov 18 18:00", total: 82, web: 37, mobile: 45 }, { slot: 37, label: "Nov 18 18:15", total: 79, web: 35, mobile: 44 }, { slot: 38, label: "Nov 18 18:30", total: 77, web: 34, mobile: 43 }, { slot: 39, label: "Nov 18 18:45", total: 75, web: 33, mobile: 42 }, { slot: 40, label: "Nov 18 19:00", total: 74, web: 33, mobile: 41 }, { slot: 41, label: "Nov 18 19:15", total: 73, web: 33, mobile: 40 }, { slot: 42, label: "Nov 18 19:30", total: 72, web: 34, mobile: 38 }, { slot: 43, label: "Nov 18 19:45", total: 70, web: 34, mobile: 36 }, { slot: 44, label: "Nov 18 20:00", total: 68, web: 34, mobile: 34 }, { slot: 45, label: "Nov 18 20:15", total: 66, web: 34, mobile: 32 }, { slot: 46, label: "Nov 18 20:30", total: 64, web: 34, mobile: 30 }, { slot: 47, label: "Nov 18 20:45", total: 61, web: 33, mobile: 28 }, { slot: 48, label: "Nov 18 21:00", total: 58, web: 32, mobile: 26 }, { slot: 49, label: "Nov 18 21:15", total: 55, web: 31, mobile: 24 }, { slot: 50, label: "Nov 18 21:30", total: 53, web: 31, mobile: 22 }, { slot: 51, label: "Nov 18 21:45", total: 50, web: 30, mobile: 20 }, { slot: 52, label: "Nov 18 22:00", total: 48, web: 29, mobile: 19 }, { slot: 53, label: "Nov 18 22:15", total: 46, web: 28, mobile: 18 }, { slot: 54, label: "Nov 18 22:30", total: 44, web: 27, mobile: 17 }, { slot: 55, label: "Nov 18 22:45", total: 43, web: 27, mobile: 16 }, { slot: 56, label: "Nov 18 23:00", total: 41, web: 26, mobile: 15 }, { slot: 57, label: "Nov 18 23:15", total: 40, web: 25, mobile: 15 }, { slot: 58, label: "Nov 18 23:30", total: 39, web: 24, mobile: 15 }, { slot: 59, label: "Nov 18 23:45", total: 38, web: 24, mobile: 14 }, { slot: 60, label: "Nov 19 00:00", total: 37, web: 23, mobile: 14 }, { slot: 61, label: "Nov 19 00:15", total: 36, web: 22, mobile: 14 }, { slot: 62, label: "Nov 19 00:30", total: 36, web: 22, mobile: 14 }, { slot: 63, label: "Nov 19 00:45", total: 35, web: 21, mobile: 14 }, { slot: 64, label: "Nov 19 01:00", total: 36, web: 21, mobile: 15 }, { slot: 65, label: "Nov 19 01:15", total: 37, web: 22, mobile: 15 }, { slot: 66, label: "Nov 19 01:30", total: 38, web: 23, mobile: 15 }, { slot: 67, label: "Nov 19 01:45", total: 39, web: 23, mobile: 16 }, { slot: 68, label: "Nov 19 02:00", total: 41, web: 24, mobile: 17 }, { slot: 69, label: "Nov 19 02:15", total: 43, web: 25, mobile: 18 }, { slot: 70, label: "Nov 19 02:30", total: 45, web: 26, mobile: 19 }, { slot: 71, label: "Nov 19 02:45", total: 47, web: 28, mobile: 19 }, { slot: 72, label: "Nov 19 03:00", total: 50, web: 30, mobile: 20 }, { slot: 73, label: "Nov 19 03:15", total: 53, web: 32, mobile: 21 }, { slot: 74, label: "Nov 19 03:30", total: 56, web: 35, mobile: 21 }, { slot: 75, label: "Nov 19 03:45", total: 59, web: 37, mobile: 22 }, { slot: 76, label: "Nov 19 04:00", total: 63, web: 40, mobile: 23 }, { slot: 77, label: "Nov 19 04:15", total: 66, web: 43, mobile: 23 }, { slot: 78, label: "Nov 19 04:30", total: 70, web: 46, mobile: 24 }, { slot: 79, label: "Nov 19 04:45", total: 74, web: 49, mobile: 25 }, { slot: 80, label: "Nov 19 05:00", total: 78, web: 52, mobile: 26 }, { slot: 81, label: "Nov 19 05:15", total: 82, web: 55, mobile: 27 }, { slot: 82, label: "Nov 19 05:30", total: 86, web: 58, mobile: 28 }, { slot: 83, label: "Nov 19 05:45", total: 89, web: 60, mobile: 29 }, { slot: 84, label: "Nov 19 06:00", total: 93, web: 63, mobile: 30 }, { slot: 85, label: "Nov 19 06:15", total: 96, web: 66, mobile: 30 }, { slot: 86, label: "Nov 19 06:30", total: 99, web: 68, mobile: 31 }, { slot: 87, label: "Nov 19 06:45", total: 102, web: 70, mobile: 32 }, { slot: 88, label: "Nov 19 07:00", total: 105, web: 73, mobile: 32 }, { slot: 89, label: "Nov 19 07:15", total: 108, web: 75, mobile: 33 }, { slot: 90, label: "Nov 19 07:30", total: 111, web: 78, mobile: 33 }, { slot: 91, label: "Nov 19 07:45", total: 114, web: 80, mobile: 34 }, { slot: 92, label: "Nov 19 08:00", total: 117, web: 82, mobile: 35 }, { slot: 93, label: "Nov 19 08:15", total: 120, web: 85, mobile: 35 }, { slot: 94, label: "Nov 19 08:30", total: 122, web: 86, mobile: 36 }, { slot: 95, label: "Nov 19 09:00", total: 124, web: 88, mobile: 36 },];
const ACTIVE_SESSIONS_CHART_DATA = ACTIVE_SESSIONS_DATA.map((pt) => ({ label: pt.label, "Total Sessions": pt.total, Web: pt.web, Mobile: pt.mobile,}));
const RAW_METRICS = [ { label: "Weekly Active Users", value: "64.8 k", change: "+21.4%", positive: true, sparkline: [ 34, 37, 40, 39, 43, 28, 25, 42, 45, 44, 48, 51, 31, 29, 49, 53, 52, 56, 58, 35, 33, 57, 61, 63, 66, 69, 42, 39, 71, 74, ], }, { label: "Docs Page Views", value: "142.6 k", change: "+15.8%", positive: true, sparkline: [ 44, 42, 46, 48, 47, 22, 20, 49, 51, 50, 53, 55, 25, 23, 54, 57, 56, 59, 62, 29, 26, 61, 64, 67, 65, 70, 34, 31, 72, 76, ], }, { label: "Median Read Time", value: "3.8 min", change: "+6.2%", positive: true, sparkline: [ 38, 40, 39, 41, 42, 34, 32, 41, 43, 44, 42, 45, 36, 35, 44, 46, 47, 45, 48, 39, 38, 49, 50, 52, 51, 53, 44, 43, 54, 56, ], }, { label: "Exit Rate", value: "34.1%", change: "-5.4%", positive: false, sparkline: [ 54, 52, 55, 51, 50, 56, 54, 49, 48, 50, 47, 46, 51, 49, 45, 44, 43, 42, 40, 45, 43, 39, 38, 37, 36, 35, 39, 37, 34, 32, ], },] as const;
const METRICS = RAW_METRICS.map((metric) => ({ ...metric, sparklineData: metric.sparkline.map((value, idx) => ({ day: `Day ${idx + 1}`, value, })),}));
interface SegmentItem { label: string; value: number; color: ChartColorName;}
const GEOGRAPHY_DATA: SegmentItem[] = [ { label: "North America", value: 42, color: "blue" }, { label: "Europe", value: 31, color: "orange" }, { label: "Asia-Pacific", value: 18, color: "emerald" }, { label: "Latin America", value: 6, color: "violet" }, { label: "Other", value: 3, color: "slate" },];
const DISCIPLINE_DATA: SegmentItem[] = [ { label: "Frontend", value: 48, color: "blue" }, { label: "Full-Stack", value: 24, color: "orange" }, { label: "Design Systems", value: 14, color: "emerald" }, { label: "Platform", value: 9, color: "violet" }, { label: "Other", value: 5, color: "slate" },];
const TOP_ROUTES = [ { id: "1", route: "/blocks", views: 12840, newUsers: "58.4%", avgTime: "4:18" }, { id: "2", route: "/components/button", views: 9420, newUsers: "41.2%", avgTime: "3:26" }, { id: "3", route: "/components/dialog", views: 7860, newUsers: "36.9%", avgTime: "4:52" }, { id: "4", route: "/components/combobox", views: 6510, newUsers: "49.5%", avgTime: "5:14" }, { id: "5", route: "/blocks/dashboards", views: 5390, newUsers: "64.1%", avgTime: "3:49" }, { id: "6", route: "/components/table", views: 4620, newUsers: "33.7%", avgTime: "5:05" }, { id: "7", route: "/components/tabs", views: 3980, newUsers: "44.0%", avgTime: "2:47" }, { id: "8", route: "/components/menu", views: 3440, newUsers: "31.8%", avgTime: "4:11" }, { id: "9", route: "/blocks/ai", views: 2890, newUsers: "68.2%", avgTime: "4:36" }, { id: "10", route: "/changelog", views: 2150, newUsers: "24.6%", avgTime: "3:12" },];
const TOP_INTERACTIONS = [ { id: "1", event: "copy_code", count: 24180, users: 14620, newUsers: 5380 }, { id: "2", event: "engine_switch", count: 16940, users: 10210, newUsers: 4190 }, { id: "3", event: "preview_interact", count: 13520, users: 8940, newUsers: 3610 }, { id: "4", event: "cli_copy", count: 9280, users: 6430, newUsers: 2890 }, { id: "5", event: "search_query", count: 6810, users: 4720, newUsers: 1940 }, { id: "6", event: "theme_toggle", count: 5140, users: 3890, newUsers: 1420 }, { id: "7", event: "block_fullscreen", count: 3760, users: 2810, newUsers: 1120 }, { id: "8", event: "filter_category", count: 2940, users: 2190, newUsers: 870 }, { id: "9", event: "docs_export", count: 1820, users: 1340, newUsers: 520 }, { id: "10", event: "share_link", count: 1190, users: 890, newUsers: 340 },];
const MAX_ROUTE_VIEWS = Math.max(...TOP_ROUTES.map((r) => r.views));const MAX_INTERACTION_COUNT = Math.max(...TOP_INTERACTIONS.map((r) => r.count));
const styles = stylex.create({ root: { backgroundColor: semanticColors.bg, color: semanticColors.fg, display: "flex", flexDirection: "column", fontFamily: fonts.body, height: "100%", minHeight: 0, overflowY: "auto", width: "100%", }, content: { paddingBlock: spacing._6, paddingInline: spacing._6, width: "100%", }, sectionHeading: { marginBlock: 0, }, metricBody: { paddingBlock: spacing._4, paddingInline: spacing._4, }, deltaIcon: { alignItems: "center", display: "inline-flex", }, sparklineHost: { marginTop: spacing._1, }, twoColGrid: { gridTemplateColumns: "repeat(auto-fit, minmax(20rem, 1fr))", }, cardInner: { paddingBlock: spacing._5, paddingInline: spacing._5, }, tableScroll: { overflowX: "auto", width: "100%", }, progressCell: { minWidth: "7rem", },});
function RefreshIcon() { return ( <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.9" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M21 12a9 9 0 1 1-2.64-6.36" /> <polyline points="21 3 21 9 15 9" /> </svg> );}
function ArrowUpIcon() { return ( <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.25" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <line x1="12" y1="19" x2="12" y2="5" /> <polyline points="5 12 12 5 19 12" /> </svg> );}
function ArrowDownIcon() { return ( <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.25" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <line x1="12" y1="5" x2="12" y2="19" /> <polyline points="19 12 12 19 5 12" /> </svg> );}
function AudienceDistributionCard({ title, data }: { title: string; data: SegmentItem[] }) { return ( <Card.Root variant="outline"> <VStack gap="4" style={styles.cardInner}> <Heading render={<h3 />} size="sm" style={styles.sectionHeading}> {title} </Heading> <CategoryBar values={data.map((seg) => seg.value)} labels={data.map((seg) => seg.label)} colors={data.map((seg) => seg.color)} valueFormatter={(value) => `${value}%`} ariaLabel={`${title} distribution`} /> </VStack> </Card.Root> );}
export interface AnalyticsDashboardProps extends StyleOverrideProps {}
/** * AnalyticsDashboard — three-band analytics screen powered by UI SDK Chart * primitives: active-sessions multi-series line chart and KPI sparkline tiles, * audience distribution category bars, and supporting top-routes and * top-interactions engagement tables. */export function AnalyticsDashboard({ palette, style }: AnalyticsDashboardProps) { const queue = useMemo(() => Toast.createToaster(), []);
return ( <div {...stylex.props(styles.root, palette, style)}> <VStack render={<main />} gap="6" style={styles.content}> <VisuallyHidden render={<h1 />}>Dashboard</VisuallyHidden>
{/* Band 1: Active sessions chart + KPI cards */} <VStack render={<section />} gap="3"> <HStack justify="between" align="center" gap="3"> <Heading render={<h2 />} size="lg" style={styles.sectionHeading}> Active sessions </Heading> <Button variant="surface" size="sm" onClick={() => queue.info("Demo: session telemetry would refresh here")} > <RefreshIcon /> Refresh </Button> </HStack>
<LineChart data={ACTIVE_SESSIONS_CHART_DATA} index="label" categories={["Total Sessions", "Web", "Mobile"]} colors={["blue", "orange", "violet"]} height={280} curve="linear" ariaLabel="Active sessions over the last 24 hours across Total Sessions, Web, and Mobile" /> </VStack>
<Grid render={<section aria-label="Headline metrics" />} columns="autoFit" gap="4"> {METRICS.map((metric) => ( <Card.Root key={metric.label} variant="outline"> <VStack gap="2" style={styles.metricBody}> <Stat.Root size="md"> <Stat.Label>{metric.label}</Stat.Label> <HStack align="baseline" wrap="wrap" gap="2"> <Stat.ValueText>{metric.value}</Stat.ValueText> <HStack render={<span />} align="center" gap="0.5"> <Text render={<span />} size="sm" weight="medium" tone={metric.positive ? "success" : "error"} style={styles.deltaIcon} > {metric.positive ? <ArrowUpIcon /> : <ArrowDownIcon />} </Text> <Text render={<span />} size="sm" weight="medium" tone="muted" tabular="true"> {metric.change} </Text> </HStack> </HStack> <Stat.HelpText>Last 14 days vs. prior period</Stat.HelpText> </Stat.Root> <Sparkline data={metric.sparklineData} index="day" categories={["value"]} colors={["blue"]} height={40} curve="linear" ariaLabel={`${metric.label} 30-day trend`} style={styles.sparklineHost} /> </VStack> </Card.Root> ))} </Grid>
<Separator />
{/* Band 2: Audience */} <HStack justify="between" align="center" gap="3"> <Heading render={<h2 />} size="lg" style={styles.sectionHeading}> Audience </Heading> <Button variant="surface" size="sm" onClick={() => queue.info("Demo: full audience breakdown would open here")} > View more </Button> </HStack>
<Grid render={<section aria-label="Audience breakdown" />} gap="4" style={styles.twoColGrid}> <AudienceDistributionCard title="Geography" data={GEOGRAPHY_DATA} /> <AudienceDistributionCard title="Discipline" data={DISCIPLINE_DATA} /> </Grid>
<Separator />
{/* Band 3: Activity tables */} <HStack justify="between" align="center" gap="3"> <Heading render={<h2 />} size="lg" style={styles.sectionHeading}> Activity </Heading> <Button variant="surface" size="sm" onClick={() => queue.info("Demo: full activity report would open here")} > View more </Button> </HStack>
<Grid render={<section aria-label="Activity tables" />} gap="4" style={styles.twoColGrid}> <Card.Root variant="outline"> <VStack gap="4" style={styles.cardInner}> <HStack justify="between" align="center" gap="2"> <Heading render={<h3 />} size="sm" style={styles.sectionHeading}> Top routes </Heading> <Link href="#top-routes" onClick={(e) => { e.preventDefault(); queue.info("Demo: all routes view would open here"); }} > All routes </Link> </HStack> <div {...stylex.props(styles.tableScroll)}> <Table.Root size="sm"> <Table.Header> <Table.Row> <Table.ColumnHeader>Route</Table.ColumnHeader> <Table.ColumnHeader>Views</Table.ColumnHeader> <Table.ColumnHeader>New Visitors</Table.ColumnHeader> <Table.ColumnHeader>Median Time</Table.ColumnHeader> </Table.Row> </Table.Header> <Table.Body> {TOP_ROUTES.map((row) => ( <Table.Row key={row.id}> <Table.Cell> <Text render={<span />} variant="mono" size="xs"> {row.route} </Text> </Table.Cell> <Table.Cell> <VStack gap="1" style={styles.progressCell}> <Progress.Root value={row.views} max={MAX_ROUTE_VIEWS} size="xs" palette={bluePalette} aria-label={`${row.route} views`} > <Progress.Track> <Progress.Range /> </Progress.Track> </Progress.Root> <Text render={<span />} size="xs" tone="muted" tabular="true"> {row.views.toLocaleString()} views </Text> </VStack> </Table.Cell> <Table.Cell>{row.newUsers}</Table.Cell> <Table.Cell>{row.avgTime}</Table.Cell> </Table.Row> ))} </Table.Body> </Table.Root> </div> </VStack> </Card.Root>
<Card.Root variant="outline"> <VStack gap="4" style={styles.cardInner}> <HStack justify="between" align="center" gap="2"> <Heading render={<h3 />} size="sm" style={styles.sectionHeading}> Top interactions </Heading> <Link href="#top-interactions" onClick={(e) => { e.preventDefault(); queue.info("Demo: all interactions view would open here"); }} > All interactions </Link> </HStack> <div {...stylex.props(styles.tableScroll)}> <Table.Root size="sm"> <Table.Header> <Table.Row> <Table.ColumnHeader>Interaction</Table.ColumnHeader> <Table.ColumnHeader>Count</Table.ColumnHeader> <Table.ColumnHeader>Users</Table.ColumnHeader> <Table.ColumnHeader>New Users</Table.ColumnHeader> </Table.Row> </Table.Header> <Table.Body> {TOP_INTERACTIONS.map((row) => ( <Table.Row key={row.id}> <Table.Cell> <Text render={<span />} variant="mono" size="xs"> {row.event} </Text> </Table.Cell> <Table.Cell> <VStack gap="1" style={styles.progressCell}> <Progress.Root value={row.count} max={MAX_INTERACTION_COUNT} size="xs" palette={bluePalette} aria-label={`${row.event} count`} > <Progress.Track> <Progress.Range /> </Progress.Track> </Progress.Root> <Text render={<span />} size="xs" tone="muted" tabular="true"> {row.count.toLocaleString()} </Text> </VStack> </Table.Cell> <Table.Cell>{row.users.toLocaleString()}</Table.Cell> <Table.Cell>{row.newUsers.toLocaleString()}</Table.Cell> </Table.Row> ))} </Table.Body> </Table.Root> </div> </VStack> </Card.Root> </Grid> </VStack>
<Toaster toaster={queue} /> </div> );}
Inspired by the Analytics Dashboard template from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.).