# Developer portal template

A responsive developer portal with a quickstart, API key metadata, webhook controls and supplied usage limits.

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

## When to use

- Use it to start a complete developer portal template whose major regions should share one responsive composition.
- Choose it as the nav region when composing a page from independently reusable TidalUI sections.

## 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 developer portal 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 Developer portal template

```sh
npx shadcn@latest add @tidal-pro/developer-portal-template
```

Stylesheets: `components/ui/tidal.css`, `components/ui/developer-portal-template.css`.

## Minimal example

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

## Structured props

- `TidalDeveloperPortalTemplate.apiKeys: Omit<TidalApiKeyManagerProps, "aria-disabled" | "headingLevel">`: Required api keys value accepted by this exported component.
- `TidalDeveloperPortalTemplate.quickstart: Omit<TidalCodeBlockProps, "aria-disabled" | "dangerouslySetInnerHTML" | "caption"> & { caption?: ReactNode; }`: Required quickstart value accepted by this exported component.
- `TidalDeveloperPortalTemplate.title: ReactNode`: Required title value accepted by this exported component.
- `TidalDeveloperPortalTemplate.usage: Omit<TidalUsageLimitsProps, "aria-disabled" | "dangerouslySetInnerHTML" | "headingLevel">`: Required usage value accepted by this exported component.
- `TidalDeveloperPortalTemplate.webhooks: Omit<TidalWebhookManagerProps, "headingLevel">`: Required webhooks value accepted by this exported component.
- `TidalDeveloperPortalTemplate.apiKeysRef?: Ref<HTMLElement> | undefined`: Optional api keys ref value accepted by this exported component.
- `TidalDeveloperPortalTemplate.description?: ReactNode`: Optional description value accepted by this exported component.
- `TidalDeveloperPortalTemplate.docsHref?: string | undefined`: Optional docs href value accepted by this exported component.
- `TidalDeveloperPortalTemplate.docsLabel?: ReactNode`: Optional docs label value accepted by this exported component.
- `TidalDeveloperPortalTemplate.docsLinkProps?: NativeLinkProps | undefined`: Optional docs link props value accepted by this exported component.
- `TidalDeveloperPortalTemplate.docsLinkRef?: Ref<HTMLAnchorElement> | undefined`: Optional docs link ref value accepted by this exported component.
- `TidalDeveloperPortalTemplate.eyebrow?: ReactNode`: Optional eyebrow value accepted by this exported component.
- `TidalDeveloperPortalTemplate.footer?: ReactNode`: Optional footer value accepted by this exported component.
- `TidalDeveloperPortalTemplate.labels?: Partial<TidalDeveloperPortalTemplateLabels> | undefined`: Optional labels value accepted by this exported component.
- `TidalDeveloperPortalTemplate.quickstartDescription?: ReactNode`: Optional quickstart description value accepted by this exported component.
- `TidalDeveloperPortalTemplate.quickstartRef?: Ref<HTMLElement> | undefined`: Optional quickstart ref value accepted by this exported component.
- `TidalDeveloperPortalTemplate.usageRef?: Ref<HTMLElement> | undefined`: Optional usage ref value accepted by this exported component.
- `TidalDeveloperPortalTemplate.webhooksRef?: Ref<HTMLElement> | undefined`: Optional webhooks ref value accepted by this exported component.

## Complete usage example

[Source](https://tidalui.com/examples/developer-portal-template.tsx) | [Manifest](https://tidalui.com/examples/developer-portal-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
import "./components/ui/tidal.css";

import { useLayoutEffect, useRef, useState } from "react";

import { TidalDeveloperPortalTemplate } from "./components/ui/developer-portal-template";

import type { TidalApiKeyRecord } from "./components/ui/api-key-manager";

import { TidalWebhookEndpointForm, type TidalWebhookEndpoint } from "./components/ui/webhook-manager";

import type { TidalUsageMetric } from "./components/ui/usage-limits";

import { TidalButton } from "./components/ui/tidal-button";

import "./components/ui/api-key-manager.css";

import "./components/ui/webhook-manager.css";

import "./components/ui/usage-limits.css";

import "./components/ui/developer-portal-template.css";

import "./components/ui/code-block.css";

import "./components/ui/status-badge.css";

import "./components/ui/toggle-switch.css";

import "./components/ui/collapsible-panel.css";

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



const tidalExampleStyles = ".tidal-scope .tidal-developer-portal-confirmation {\n  display: grid;\n  gap: 10px;\n  margin-block-start: 14px;\n  padding: 12px;\n  border: 1px solid var(--t-border);\n  border-radius: 10px;\n  background: var(--t-subtle);\n}\n.tidal-scope .tidal-developer-portal-confirmation p {\n  margin: 0;\n  font-size: 12px;\n  line-height: 1.5;\n  overflow-wrap: anywhere;\n}\n.tidal-scope .tidal-developer-portal-confirmation > div {\n  display: flex;\n  flex-wrap: wrap;\n  gap: 8px;\n}";

const INITIAL_KEYS: TidalApiKeyRecord[] = [
  {
    id: "key-sample-1",
    name: "Local development",
    maskedValue: "tidal_sample_••••7F2A",
    scopes: ["projects:read", "events:read"],
    status: "active",
    created: { label: "October 12, 2026", dateTime: "2026-10-12" },
    lastUsed: { label: "Sample activity 18 minutes ago" },
  },
  {
    id: "key-sample-2",
    name: "Reporting preview",
    maskedValue: "tidal_sample_••••1C09",
    scopes: ["reports:read"],
    status: "active",
    created: { label: "October 4, 2026", dateTime: "2026-10-04" },
  },
];

const INITIAL_ENDPOINTS: TidalWebhookEndpoint[] = [
  {
    id: "endpoint-sample",
    name: "Local event receiver",
    url: "https://example.test/hooks/tidal",
    enabled: true,
    signing: "configured",
    events: ["project.updated", "report.ready"],
    deliveriesOpen: false,
    deliveries: [
      {
        id: "delivery-sample",
        event: "project.updated",
        outcome: "delivered",
        time: { label: "Sample delivery at 2:14 PM" },
        response: "204 sample response",
        duration: "184 ms",
      },
    ],
  },
];

const WEEKLY_USAGE: readonly TidalUsageMetric[] = [
  {
    id: "requests",
    kind: "metered",
    label: "API requests",
    value: 18420,
    limit: 50000,
    valueText: "18,420",
    limitText: "50,000",
    reset: { label: "Sample period resets Monday" },
  },
  {
    id: "events",
    kind: "metered",
    label: "Webhook events",
    value: 2100,
    limit: 10000,
    valueText: "2,100",
    limitText: "10,000",
  },
];

const MONTHLY_USAGE: readonly TidalUsageMetric[] = [
  {
    id: "requests",
    kind: "metered",
    label: "API requests",
    value: 74600,
    limit: 200000,
    valueText: "74,600",
    limitText: "200,000",
    reset: { label: "Sample period resets November 1" },
  },
  {
    id: "events",
    kind: "metered",
    label: "Webhook events",
    value: 8600,
    limit: 40000,
    valueText: "8,600",
    limitText: "40,000",
  },
];

const WEBHOOK_EVENTS = [
  { value: "project.updated", label: "Project updated" },
  { value: "report.ready", label: "Report ready" },
  { value: "workspace.created", label: "Workspace created" },
] as const;

export function DeveloperPortalTemplateDemo() {
  const [keys, setKeys] = useState(INITIAL_KEYS);
  const [endpoints, setEndpoints] = useState(INITIAL_ENDPOINTS);
  const [period, setPeriod] = useState<"week" | "month">("week");
  const [pendingRevokeId, setPendingRevokeId] = useState<string>();
  const [editingEndpointId, setEditingEndpointId] = useState<string | null>(
    null,
  );
  const [endpointValues, setEndpointValues] = useState({
    name: "",
    url: "",
    events: [] as readonly string[],
  });
  const [status, setStatus] = useState("Developer sample ready.");
  const createKeyRef = useRef<HTMLButtonElement>(null);
  const createEndpointRef = useRef<HTMLButtonElement>(null);
  const endpointOpenerRef = useRef<HTMLButtonElement | null>(null);
  const endpointNameRef = useRef<HTMLInputElement>(null);
  const localRecordSequence = useRef(1);
  const pendingRevoke = keys.find((record) => record.id === pendingRevokeId);

  useLayoutEffect(() => {
    if (editingEndpointId === null) return;
    const input = endpointNameRef.current;
    const ownerWindow = input?.ownerDocument.defaultView;
    if (!input || !ownerWindow) return;
    const frame = ownerWindow.requestAnimationFrame(() => {
      input.focus({ preventScroll: true });
      input.scrollIntoView({ block: "nearest", inline: "nearest" });
    });
    return () => ownerWindow.cancelAnimationFrame(frame);
  }, [editingEndpointId]);

  const returnToKeyManager = () => {
    queueMicrotask(() => createKeyRef.current?.focus({ preventScroll: true }));
  };
  const closeEndpointEditor = () => {
    setEditingEndpointId(null);
    queueMicrotask(() =>
      (endpointOpenerRef.current ?? createEndpointRef.current)?.focus({
        preventScroll: true,
      }),
    );
  };

  return (
    <TidalDeveloperPortalTemplate
      title="Build with the workspace API"
      eyebrow="Developer portal"
      description="Follow the quickstart, inspect sample credentials, configure a local webhook, and review supplied usage readings."
      quickstartDescription="Review a fictional client setup. The code is displayed and never executed."
      quickstart={{
        filename: "quickstart.ts",
        language: "TypeScript",
        code: `const client = createWorkspaceClient({\n  endpoint: "https://api.example.test",\n  token: "YOUR_KEY",\n});\n\nconst projects = await client.projects.list();`,
        caption:
          "Replace the sample endpoint and token in your own environment.",
        maxHeight: 260,
      }}
      apiKeys={{
        title: "API keys",
        description: "Masked fictional metadata for this preview.",
        keys,
        createButtonRef: createKeyRef,
        onCreateRequest: () => {
          const sampleId = "key-local-created";
          if (keys.some((record) => record.id === sampleId)) {
            setStatus("The local sample key is already visible.");
            return;
          }
          setKeys((items) => [
            ...items,
            {
              id: sampleId,
              name: "New local sample",
              maskedValue: "tidal_sample_••••8B14",
              scopes: ["projects:read"],
              status: "active",
              created: { label: "Created in this preview" },
              lastUsed: { label: "Never used" },
            },
          ]);
          setStatus(
            "A masked fictional key record was added locally. No credential was generated.",
          );
        },
        onRevokeRequest: (record) => {
          setPendingRevokeId(record.id);
          setStatus(`Confirm the local revoke for ${record.name}.`);
        },
        dialog: pendingRevoke ? (
          <section
            className="tidal-developer-portal-confirmation"
            aria-label="Confirm sample key revocation"
          >
            <p>
              Mark <strong>{pendingRevoke.name}</strong> revoked in this local
              sample?
            </p>
            <div>
              <TidalButton
                type="button"
                variant="primary"
                onClick={() => {
                  setKeys((items) =>
                    items.map((item) =>
                      item.id === pendingRevoke.id
                        ? { ...item, status: "revoked" }
                        : item,
                    ),
                  );
                  setStatus(
                    `${pendingRevoke.name} was marked revoked in local sample state.`,
                  );
                  setPendingRevokeId(undefined);
                  returnToKeyManager();
                }}
              >
                Confirm local revoke
              </TidalButton>
              <TidalButton
                type="button"
                variant="secondary"
                onClick={() => {
                  setPendingRevokeId(undefined);
                  setStatus("Local revoke canceled.");
                  returnToKeyManager();
                }}
              >
                Keep key
              </TidalButton>
            </div>
          </section>
        ) : null,
      }}
      webhooks={{
        title: "Webhooks",
        description:
          "One fictional endpoint and exact supplied delivery metadata.",
        endpoints,
        createButtonRef: createEndpointRef,
        onCreateRequest: (event) => {
          endpointOpenerRef.current = event.currentTarget;
          setEndpointValues({ name: "", url: "", events: [] });
          setEditingEndpointId("new");
          setStatus("Complete the local endpoint form.");
        },
        onEnabledChange: (endpoint, enabled) => {
          setEndpoints((items) =>
            items.map((item) =>
              item.id === endpoint.id ? { ...item, enabled } : item,
            ),
          );
          setStatus(
            `${endpoint.name} is ${enabled ? "enabled" : "paused"} in local sample state.`,
          );
        },
        onTestRequest: (endpoint) => {
          const id = `local-delivery-${localRecordSequence.current++}`;
          setEndpoints((items) =>
            items.map((item) =>
              item.id === endpoint.id
                ? {
                    ...item,
                    deliveriesOpen: true,
                    deliveries: [
                      {
                        id,
                        event: "webhook.test",
                        outcome: "delivered",
                        time: { label: "Just now · local sample" },
                        response: "204 sample response",
                        duration: "96 ms",
                      },
                      ...item.deliveries,
                    ],
                  }
                : item,
            ),
          );
          setStatus(
            `A fictional delivery was added for ${endpoint.name}. No network request was sent.`,
          );
        },
        onEditRequest: (endpoint, event) => {
          endpointOpenerRef.current = event.currentTarget;
          setEndpointValues({
            name: endpoint.name,
            url: endpoint.url,
            events: endpoint.events,
          });
          setEditingEndpointId(endpoint.id);
          setStatus(`Edit ${endpoint.name} in the local form.`);
        },
        onDeliveriesOpenChange: (endpoint, open) =>
          setEndpoints((items) =>
            items.map((item) =>
              item.id === endpoint.id
                ? { ...item, deliveriesOpen: open }
                : item,
            ),
          ),
        editor:
          editingEndpointId !== null ? (
            <TidalWebhookEndpointForm
              nameInputRef={endpointNameRef}
              nameValue={endpointValues.name}
              urlValue={endpointValues.url}
              selectedEvents={endpointValues.events}
              eventOptions={WEBHOOK_EVENTS}
              onValueChange={setEndpointValues}
              onCancel={closeEndpointEditor}
              onSubmit={(event) => {
                event.preventDefault();
                const name = endpointValues.name.trim();
                const endpointId =
                  editingEndpointId === "new"
                    ? `endpoint-local-${localRecordSequence.current++}`
                    : editingEndpointId;
                setEndpoints((items) =>
                  editingEndpointId === "new"
                    ? [
                        ...items,
                        {
                          id: endpointId,
                          name,
                          url: endpointValues.url,
                          enabled: false,
                          signing: "not-configured",
                          events: endpointValues.events,
                          deliveries: [],
                          deliveriesOpen: false,
                        },
                      ]
                    : items.map((item) =>
                        item.id === editingEndpointId
                          ? {
                              ...item,
                              name,
                              url: endpointValues.url,
                              events: endpointValues.events,
                            }
                          : item,
                      ),
                );
                setStatus(`${name} was saved in local sample state.`);
                closeEndpointEditor();
              }}
            />
          ) : undefined,
      }}
      usage={{
        title: "Usage",
        description: `Fictional ${period === "week" ? "weekly" : "monthly"} allowance readings.`,
        metrics: period === "week" ? WEEKLY_USAGE : MONTHLY_USAGE,
        action: (
          <TidalButton
            type="button"
            variant="secondary"
            onClick={() => {
              setPeriod((value) => (value === "week" ? "month" : "week"));
              setStatus("Local usage period changed.");
            }}
          >
            Show {period === "week" ? "month" : "week"}
          </TidalButton>
        ),
      }}
      footer={
        <>
          <strong role="status">{status}</strong>
          <span>
            {" "}
            Fictional records only. No credential, webhook, request, account, or
            usage service is connected.
          </span>
        </>
      }
    />
  );
}

export default function AgentExample() {
  return (
    <div className="tidal-scope" data-theme="light" dir="ltr">
      <style>{tidalExampleStyles}</style>
      <DeveloperPortalTemplateDemo />
    </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}

{"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 single page h1 inside a div, so the template can be embedded without a nested main landmark. Required quickstart, apiKeys, webhooks and usage configurations are inferred from @tidal-pro/code-block, @tidal-pro/api-key-manager, @tidal-pro/webhook-manager and @tidal-pro/usage-limits. The template fixes composed section headings at h2 and forwards each remaining consumer-owned native, controlled, action, loading, empty and error contract. Dedicated quickstartRef, apiKeysRef, webhooksRef and usageRef point to the four composed roots. Optional eyebrow, description, quickstartDescription, localized navigation and section labels, footer, root div attributes/ref, and a real documentation anchor with native attributes/ref are supported. Root/documentation inherited aria-disabled, quickstart/usage raw markup and quickstart/API-key/usage aggregate aria-disabled are excluded and runtime-stripped because they conflict with template-owned children or independently operable descendants. Generated in-page links target stable section IDs. The template performs no code execution, credential operation, request, webhook delivery, usage calculation, account lookup, network access, storage or persistence.
