Skip to content

@xtandard/links/react

@xtandard/links/react — embed the links dashboard, or the per-tenant analytics widget, as React components in your own app (ADR 0003). Most hosts mount the bundled SPA through a framework adapter and never touch React; this is for teams that want the panel inside an existing React shell.

Two components share the same SPA internals:

import { LinksDashboard, LinkAnalytics } from "@xtandard/links/react";
import "@xtandard/links/react/styles.css";
// Full admin — point it at wherever the panel API is mounted:
<LinksDashboard apiBaseUrl="/links" />
// Your customer's analytics — pass a viewer token minted server-side
// (`createViewerToken` or POST /api/tenants/:tenant/viewer-tokens):
<LinkAnalytics apiBaseUrl="/links" token={viewerToken} />

react and react-dom are peer dependencies in this mode. The components are self-contained otherwise (TanStack Query and styles are bundled).

import { … } from "@xtandard/links/react";
Name Summary
LinkAnalyticsProps Props for LinkAnalytics.
LinksDashboardProps Props for LinksDashboard.
Name Summary
EmbedTheme Theme modes for the embedded components (see LinksDashboardProps.theme).
Name Summary
getThemePref The stored preference (system when unset, invalid, or storage is unavailable).
LinkAnalytics The per-tenant analytics widget (ADR 0009) as an embeddable React component: the same shell as LinksDashboard with a viewer token attached as a Bearer credential. The server force-scopes every request to the token’s tenant, links and actions; the shell renders the reduced widget chrome (analytics first, read-only links, create/edit only when granted).
LinksDashboard The full links admin dashboard as an embeddable React component.
setApiBase Point the API client at a base URL (used by the @xtandard/links/react export).
setApiToken Attach an analytics viewer token (lvt_…) as a Bearer credential on every request.
setThemePref Persist pref and notify subscribers.
Name Documented on
default (LinksDashboard) @xtandard/links/react