Xzero UI
Pro library

Install snippetPro

A "get started in 30 seconds" card where framework tabs, three numbered steps and highlighted snippets take a developer from install to first event. Generate key wipes a fresh API key into the placeholder in place.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/install-snippet
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/install-snippet

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { InstallSnippet } from "@/components/xzero/install-snippet/install-snippet";

export function Onboarding() {
  return (
    <InstallSnippet
      generateKey={async signal => {
        const res = await fetch("/api/keys", { method: "POST", signal });
        if (!res.ok) throw new Error("Could not create a key");
        return (await res.json()).key;
      }}
      onCopy={(step) => track("onboarding_copy", { step })}
    />
  );
}

API reference

InstallSnippet

A "get started in 30 seconds" card for SDK onboarding: framework tabs with real marks (Next.js, React, Vue, HTML), three numbered steps (Install, Add your key, Ship), highlighted code blocks that crossfade in reserved space, package manager tabs (npm, pnpm, yarn, bun), Xzero copy buttons, and a Generate key button that wipes the new key into the placeholder. With no props it shows the sample Lumen analytics SDK with a simulated key generator.

PropTypeDefaultDescription
titleReactNode"Get started in 30 seconds"Card title.
descriptionReactNode"Three steps to your first event."One line under the title.
versionReactNode"v2.4.0"Muted label at the top right, such as the SDK version. Pass null to hide it.
frameworksInstallSnippetFramework[]Next.js, React, Vue, HTML samplesOne entry per tab: id, label, install ({ packages } for package managers, or { file, code } for a CDN tag), key ({ file, code }) and code ({ file, code }). Write {{key}} where the API key goes. The ids next, react, vue and html get their marks automatically.
frameworkstring–Controls the selected framework id. Pair with onFrameworkChange.
defaultFrameworkstringfirst frameworkFramework selected on mount when uncontrolled.
onFrameworkChange(id: string) => void–Called when someone picks another framework tab.
packageManager"npm" | "pnpm" | "yarn" | "bun"–Controls the package manager used in step 1.
defaultPackageManager"npm" | "pnpm" | "yarn" | "bun""npm"Package manager selected on mount when uncontrolled.
onPackageManagerChange(id: InstallSnippetPackageManager) => void–Called when the package manager changes. Persist it to remember the reader's choice across pages.
apiKeystring–Controlled key. When set, the snippets show it and the Generate key button is hidden, for signed-in readers who already have a key.
keyPlaceholderstring"YOUR_LUMEN_KEY"Shown, tinted, wherever {{key}} appears until a key exists. Copies as written.
generateKey(signal: AbortSignal) => Promise<string>–Creates a real key. Resolve with the key and it wipes into step 2; reject to show the error state with Try again. Aborted on unmount or when a new key is requested. Leave it out to simulate one (nothing is sent, and the step says so).
onKeyGenerated(key: string) => void–Called with each new key.
onCopy(step: "install" | "key" | "code", value: string) => void–Called after a copy with the exact clipboard text. Useful for onboarding analytics.
classNamestring–Extra class on the card.

Keyboard interactions

KeysAction
TabMoves between the framework tabs, package manager tabs, copy buttons and the Generate key button.
ArrowLeft / ArrowRightInside a tab list, moves to and selects the previous or next tab.
Home / EndInside a tab list, selects the first or last tab.
Enter / SpaceCopies a snippet or generates a key.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in ai

Guidance for AI tools

Install snippet: A "get started in 30 seconds" card where framework tabs, three numbered steps and highlighted snippets take a developer from install to first event. Generate key wipes a fresh API key into the placeholder in place. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components