# Analytics dashboard template

An assembled responsive analytics page with a metric overview, controlled line chart, activity feed and native range and page actions.

Access: pro. Category: Templates. Kind: template.

## When to use

- Use it to start a complete analytics dashboard template whose major regions should share one responsive composition.
- Choose it inside an authenticated product surface when the host application owns routing, persistence, and service calls.

## Alternatives

- Choose dashboard-layout instead when a responsive semantic dashboard shell with composable header, navigation, main content, and an in-flow mobile disclosure is the actual interface need, rather than analytics dashboard template.

## Setup for agents

Use React 19 and TypeScript. Initialize shadcn for your framework, then merge this exact entry into components.json:

```json
{
  "registries": {
    "@tidal-pro": {
      "url": "https://tidalui.com/r/pro/{name}.json",
      "headers": {
        "Authorization": "Bearer ${TIDALUI_TOKEN}"
      }
    }
  }
}
```

The namespace must be named **@tidal-pro** because transitive Pro dependencies use that namespace. Obtain an agent key from your active Pro account at https://tidalui.com/account. Keep TIDALUI_TOKEN in your local environment, never in components.json, client code, Git or logs.

```sh
export TIDALUI_TOKEN='your-private-agent-key'
npx shadcn@latest add @tidal-pro/waitlist-form
npx shadcn@latest add https://tidalui.com/r/tidal-button.json
```

Free command: `npx shadcn@latest add https://tidalui.com/r/<name>.json`.
Pro command: `npx shadcn@latest add @tidal-pro/<name>`.

Import the base stylesheet and every stylesheet listed on the installed item's metadata. For example:

```tsx
import "./components/ui/tidal.css";
import "./components/ui/hero-section.css";
// Place installed components inside this wrapper:
<div className="tidal-scope" data-theme="dark">...</div>
```

Omit data-theme for the default light theme. Put the attribute on the same tidal-scope element for dark mode. Every component installs the shared free tidal-base dependency. After upgrading, run `npx shadcn@latest add https://tidalui.com/r/tidal-base.json --overwrite` to receive current tokens. Review local modifications before overwriting.

Vite: Use React + TypeScript. Map @/* to ./src/* in paths and Vite resolve.alias. Import tidal.css and each component stylesheet in your application entry.

Next.js 15 App Router: Next.js App Router: import tidal.css and component CSS in app/layout.tsx. Interactive examples belong in a client component with "use client". Map @/* to ./* or ./src/* to match your project.

TypeScript 6: use paths without baseUrl:

```json
{
  "compilerOptions": {
    "paths": {
      "@/*": [
        "./src/*"
      ]
    }
  }
}
```

Pro registry requests are server/CLI-only. Use the same-origin account interface in a browser; cross-origin Authorization preflights are intentionally unsupported.


## Install Analytics dashboard template

```sh
npx shadcn@latest add @tidal-pro/analytics-dashboard-template
```

Stylesheets: `components/ui/tidal.css`, `components/ui/analytics-dashboard-template.css`.

## Minimal example

```tsx
import"./components/ui/tidal.css";
import"./components/ui/analytics-dashboard-template.css";
import{TidalAnalyticsDashboardTemplate}from"./components/ui/analytics-dashboard-template";
export default(p:Parameters<typeof TidalAnalyticsDashboardTemplate>[0])=><div className="tidal-scope"><TidalAnalyticsDashboardTemplate {...p}/></div>;
```

## Structured props

- `TidalAnalyticsDashboardTemplate.activity: TidalAnalyticsDashboardActivityConfig`: Required activity value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.chart: TidalAnalyticsDashboardChartConfig`: Required chart value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.stats: TidalAnalyticsDashboardStatsConfig`: Required stats value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.title: ReactNode`: Required title value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.actions?: ReadonlyArray<TidalAnalyticsDashboardAction> | undefined` (default []): Optional actions value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.actionsLabel?: string | undefined` (default "Dashboard actions"): Optional actions label value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.eyebrow?: ReactNode`: Optional eyebrow value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalAnalyticsDashboardTemplate.range?: TidalAnalyticsDashboardRangeControl | undefined`: Optional range value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/analytics-dashboard-template.tsx) | [Manifest](https://tidalui.com/examples/analytics-dashboard-template.json). Install the listed additional dependencies. Consumer fixture: TypeScript pass; Vite pass. This fixture check is distinct from the actual shadcn install receipt.

```tsx
"use client";

import "./components/ui/tidal.css";

import { useId, useMemo, useState } from "react";

import { TidalAnalyticsDashboardTemplate, type TidalAnalyticsDashboardAction } from "./components/ui/analytics-dashboard-template";

import type { TidalStatsGridMetric } from "./components/ui/stats-grid";

import type { TidalLineChartPoint } from "./components/ui/line-chart";

import type { TidalActivityFeedGroup, TidalActivityFeedItem } from "./components/ui/activity-feed";

import "./components/ui/stats-grid.css";

import "./components/ui/line-chart.css";

import "./components/ui/activity-feed.css";

import "./components/ui/analytics-dashboard-template.css";

function tidalExampleAvatarDataUri(seed: unknown) {
  const text = String(seed).replace(/[^a-z0-9]/gi, "").slice(-2) || "UI";
  const palette = ["#333333", "#555555", "#777777", "#999999", "#bbbbbb"];
  const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length];
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><rect width="96" height="96" rx="48" fill="${color}"/><circle cx="48" cy="38" r="17" fill="white" fill-opacity=".92"/><path d="M18 92c3-22 15-34 30-34s27 12 30 34" fill="white" fill-opacity=".92"/></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

function tidalExampleImageDataUri(label: string) {
  const safeLabel = label.replace(/[<>&]/g, "").slice(0, 28) || "Sample image";
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 675"><defs><linearGradient id="g" x1="0" x2="1" y1="0" y2="1"><stop stop-color="#171717"/><stop offset="1" stop-color="#555555"/></linearGradient></defs><rect width="1200" height="675" fill="url(#g)"/><circle cx="950" cy="100" r="260" fill="white" fill-opacity=".08"/><text x="80" y="570" fill="white" font-family="system-ui,sans-serif" font-size="64" font-weight="700">${safeLabel}</text></svg>`;
  return `data:image/svg+xml,${encodeURIComponent(svg)}`;
}

const tidalExampleStyles = ".tidal-scope .analytics-demo-footer,\n.tidal-scope .analytics-demo-footer > div {\n  min-width: 0;\n}\n\n.tidal-scope .analytics-demo-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 14px;\n  padding: 12px 2px 2px;\n  border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .analytics-demo-footer > div {\n  display: grid;\n  gap: 3px;\n}\n\n.tidal-scope .analytics-demo-footer strong,\n.tidal-scope .analytics-demo-footer span,\n.tidal-scope .analytics-demo-footer output {\n  min-width: 0;\n  overflow-wrap: anywhere;\n}\n\n.tidal-scope .analytics-demo-footer strong,\n.tidal-scope .analytics-demo-footer output {\n  color: var(--t-ink);\n  font-weight: 680;\n}\n\n.tidal-scope .analytics-demo-footer > div:focus-visible {\n  outline: 2px solid var(--t-accent);\n  outline-offset: 3px;\n}\n\n@container tidal-analytics-template (max-width: 620px) {\n  .tidal-scope .analytics-demo-footer {\n    align-items: flex-start;\n    flex-direction: column;\n  }\n}";

type RangeId = "7d" | "30d" | "90d";

type ActivityFilter = "all" | "unread";

const RANGE_DATA: Record<
  RangeId,
  {
    label: string;
    visits: number;
    conversion: string;
    active: number;
    returnRate: string;
    points: readonly TidalLineChartPoint[];
  }
> = {
  "7d": {
    label: "Last 7 days",
    visits: 1842,
    conversion: "6.8%",
    active: 312,
    returnRate: "41%",
    points: [
      {
        id: "7-mon",
        label: "Oct 8",
        value: 218,
        displayValue: "218 visits",
      },
      {
        id: "7-tue",
        label: "Oct 9",
        value: 246,
        displayValue: "246 visits",
      },
      {
        id: "7-wed",
        label: "Oct 10",
        value: 231,
        displayValue: "231 visits",
      },
      {
        id: "7-thu",
        label: "Oct 11",
        value: 275,
        displayValue: "275 visits",
      },
      {
        id: "7-fri",
        label: "Oct 12",
        value: 292,
        displayValue: "292 visits",
      },
      {
        id: "7-sat",
        label: "Oct 13",
        value: 264,
        displayValue: "264 visits",
      },
      {
        id: "7-sun",
        label: "Oct 14",
        value: 316,
        displayValue: "316 visits",
      },
    ],
  },
  "30d": {
    label: "Last 30 days",
    visits: 7284,
    conversion: "6.4%",
    active: 894,
    returnRate: "38%",
    points: [
      {
        id: "30-w1",
        label: "Week 1",
        value: 1510,
        displayValue: "1,510 visits",
      },
      {
        id: "30-w2",
        label: "Week 2",
        value: 1748,
        displayValue: "1,748 visits",
      },
      {
        id: "30-w3",
        label: "Week 3",
        value: 1882,
        displayValue: "1,882 visits",
      },
      {
        id: "30-w4",
        label: "Week 4",
        value: 2144,
        displayValue: "2,144 visits",
      },
    ],
  },
  "90d": {
    label: "Last 90 days",
    visits: 20418,
    conversion: "6.1%",
    active: 2406,
    returnRate: "36%",
    points: [
      {
        id: "90-aug",
        label: "August",
        value: 6128,
        displayValue: "6,128 visits",
      },
      {
        id: "90-sep",
        label: "September",
        value: 6714,
        displayValue: "6,714 visits",
      },
      {
        id: "90-oct",
        label: "October",
        value: 7576,
        displayValue: "7,576 visits",
      },
    ],
  },
};

const INITIAL_ACTIVITY: readonly TidalActivityFeedItem[] = [
  {
    id: "report-opened",
    title: "Mina opened the sample performance report",
    dateTime: "2026-10-14T09:40:00-05:00",
    timeLabel: "9:40 AM",
    description:
      "The local report note was viewed from this fictional dashboard.",
    category: "Report",
    context: "Performance overview",
    unread: true,
    actor: {
      name: "Mina Cole",
      detail: "Fictional analyst",
      avatarSrc: tidalExampleAvatarDataUri("01"),
    },
  },
  {
    id: "segment-reviewed",
    title: "Jon reviewed the returning visitor sample",
    dateTime: "2026-10-14T08:18:00-05:00",
    timeLabel: "8:18 AM",
    description: "The displayed segment remains part of the local sample data.",
    category: "Segment",
    context: "Returning visitors",
    unread: false,
    actor: {
      name: "Jon Bell",
      detail: "Fictional researcher",
      avatarSrc: tidalExampleAvatarDataUri("02"),
    },
  },
] as const;

export function AnalyticsDashboardTemplateDemo() {
  const generatedId = useId().replace(/:/g, "");
  const chartId = `${generatedId}-traffic-chart`;
  const activityId = `${generatedId}-activity`;
  const reportNoteId = `${generatedId}-report-note`;
  const [range, setRange] = useState<RangeId>("7d");
  const [selectedPointId, setSelectedPointId] = useState(
    RANGE_DATA["7d"].points[0].id,
  );
  const [activityFilter, setActivityFilter] = useState<ActivityFilter>("all");
  const [sampleAdded, setSampleAdded] = useState(false);
  const [message, setMessage] = useState("Showing the last 7 days.");
  const data = RANGE_DATA[range];

  const activity = useMemo<readonly TidalActivityFeedItem[]>(() => {
    if (!sampleAdded) return INITIAL_ACTIVITY;
    return [
      {
        id: "sample-visit",
        title: "A sample visit was added locally",
        dateTime: "2026-10-14T10:05:00-05:00",
        timeLabel: "10:05 AM",
        description:
          "This fictional event exists only until the preview reloads.",
        category: "Visit",
        context: data.label,
        unread: true,
        actor: {
          name: "Inez Park",
          detail: "Fictional teammate",
          avatarSrc: tidalExampleAvatarDataUri("03"),
        },
      },
      ...INITIAL_ACTIVITY,
    ];
  }, [data.label, sampleAdded]);

  const visibleActivity = activity.filter(
    (item) => activityFilter === "all" || item.unread,
  );
  const activityGroups: readonly TidalActivityFeedGroup[] = [
    {
      id: "today",
      label: "Today",
      items: visibleActivity.map((item) => ({
        ...item,
        destination: {
          href: `#${reportNoteId}`,
          label: `Open local report note for ${String(item.title)}`,
          linkProps: {
            onClick: () =>
              setMessage(`${String(item.title)} opened the local report note.`),
          },
        },
      })),
    },
  ];
  const metrics: readonly TidalStatsGridMetric[] = [
    {
      id: "visits",
      label: "Visits",
      value: (data.visits + (sampleAdded ? 1 : 0)).toLocaleString(),
      valueKey: `${range}-${sampleAdded}`,
      comparison: "vs. prior sample",
      trend: "positive",
      detail: data.label,
      href: `#${chartId}`,
    },
    {
      id: "conversion",
      label: "Conversion",
      value: data.conversion,
      valueKey: range,
      comparison: "sample rate",
      trend: "neutral",
      detail: "Fictional conversion",
      href: `#${chartId}`,
    },
    {
      id: "active",
      label: "Active visitors",
      value: data.active.toLocaleString(),
      valueKey: range,
      comparison: "current sample",
      trend: "positive",
      href: `#${activityId}`,
    },
    {
      id: "returning",
      label: "Returning",
      value: data.returnRate,
      valueKey: range,
      comparison: "sample share",
      trend: "neutral",
      href: `#${activityId}`,
    },
  ];

  const actions: readonly TidalAnalyticsDashboardAction[] = [
    {
      id: "report-note",
      kind: "link",
      href: `#${reportNoteId}`,
      label: "Report note",
      linkProps: {
        onClick: () => setMessage("The local report note is open below."),
      },
    },
    {
      id: "add-event",
      kind: "button",
      label: "Add sample event",
      emphasis: "primary",
      onAction: () => {
        if (sampleAdded) {
          setMessage("The sample event is already visible.");
          return;
        }
        setSampleAdded(true);
        setActivityFilter("all");
        setMessage("One fictional event was added locally.");
      },
    },
  ];

  return (
    <TidalAnalyticsDashboardTemplate
      title="Atlas analytics"
      eyebrow="Workspace report"
      description="Review traffic trends, inspect exact values, and follow the activity behind the summary."
      range={{
        label: "Reporting range",
        value: range,
        options: (Object.keys(RANGE_DATA) as RangeId[]).map((value) => ({
          value,
          label: RANGE_DATA[value].label,
        })),
        onValueChange: (value) => {
          const nextRange = value as RangeId;
          setRange(nextRange);
          setSelectedPointId(RANGE_DATA[nextRange].points[0].id);
          setMessage(`Showing ${RANGE_DATA[nextRange].label.toLowerCase()}.`);
        },
      }}
      actions={actions}
      stats={{
        title: "Performance",
        eyebrow: null,
        description: "Four measures for the selected reporting range.",
        metrics,
      }}
      chart={{
        id: chartId,
        title: "Visits over time",
        eyebrow: null,
        description:
          "Use the native previous and next controls to inspect an exact point.",
        points: data.points,
        selectedId: selectedPointId,
        onSelectedChange: (point) => {
          setSelectedPointId(point.id);
          setMessage(`${point.label}: ${point.displayValue}.`);
        },
        yAxisLabel: "Visits",
        formatAxisValue: (value) => Math.round(value).toLocaleString(),
        tableLabel: "View supplied visit data",
      }}
      activity={{
        id: activityId,
        title: "Recent activity",
        eyebrow: null,
        description: "Events associated with this report.",
        groups: activityGroups,
        filter: {
          value: activityFilter,
          label: "Filter recent activity",
          options: [
            { id: "all", label: "All", count: activity.length },
            {
              id: "unread",
              label: "Unread",
              count: activity.filter((item) => item.unread).length,
            },
          ],
          onValueChange: (value) => {
            setActivityFilter(value as ActivityFilter);
            setMessage(`Showing ${value} sample activity.`);
          },
        },
        emptyMessage: "No sample activity matches this view.",
      }}
      footer={
        <div className="analytics-demo-footer">
          <div id={reportNoteId} tabIndex={-1}>
            <strong>Report note</strong>
            <span>This note follows the selected activity.</span>
          </div>
          <output aria-live="polite">{message}</output>
          <span>Sample data. Changes stay in this preview.</span>
        </div>
      }
    />
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <AnalyticsDashboardTemplateDemo />
    </div>
  );
}

```

## Gotchas

- The host application owns data, validation, persistence, navigation, and service side effects described by this API.

## Theme and accessibility

{"tokens":["--t-accent","--t-border","--t-border-strong","--t-canvas","--t-danger","--t-display","--t-ease-out","--t-ease-spring","--t-faint","--t-font","--t-ink","--t-line","--t-muted","--t-primary","--t-primary-contrast","--t-radius-card","--t-radius-control","--t-radius-overlay","--t-radius-panel","--t-ring","--t-shadow-lg","--t-shadow-soft","--t-soft","--t-subtle","--t-surface","--t-wash"],"darkMode":true}

{"keyboard":["Tab and Shift+Tab follow the component's native focus order.","Arrow-key behavior follows the exported composite-control implementation."],"aria":"The component wires labels and relationships from consumer-provided visible text or ARIA props; preserve those labels in production.","notes":"Verify focus visibility, text alternatives, contrast, and reduced motion in the final composition."}

title is required and renders the page h1 inside a content div, avoiding an implicit nested main landmark. Optional eyebrow and description preserve numeric zero. stats, chart and activity are required typed configurations inferred from @tidal-pro/stats-grid, @tidal-pro/line-chart and @tidal-pro/activity-feed; the template owns their h2/h3 hierarchy and forwards the remaining native component contracts. Optional range is a controlled labelled single native select with string options, disabled choices, native attributes/ref and caller-first preventable onChange composition; value, defaultValue, multiple, size, aria-label and aria-disabled are excluded while native disabled remains available. Optional ordered page actions are native buttons or real anchors with consumer labels, emphasis, disabled state, matching native attributes and refs. Button native clicks run first and prevention suppresses onAction. Disabled links prevent navigation before caller handling while explicit aria-disabled=false is preserved. Optional actionsLabel, footer and root native attributes/ref remain consumer-owned. The template performs no aggregation, filtering, mutation, request, routing, analytics, network, storage or persistence action.
