UI

Install

Three-step SDK onboarding card with framework tabs, package manager switcher, syntax-highlighted snippets, copy buttons, and inline API key generation.

import { InstallSnippet } from '@uthereal/ui/install-snippet'

Install snippet playground

Get started in 30 seconds

Three steps to your first event.

v2.4.0
  1. Install

    Add the SDK to your project
    npm install @lumen/next
  2. Add your key

    Create a project key
    .env.local
    NEXT_PUBLIC_LUMEN_KEY=YOUR_API_KEY
  3. Ship

    Deploy and watch events arrive
    app/layout.tsx
    import { Lumen } from "@lumen/next"; export default function RootLayout({ children }) {  return (    <html lang="en">      <body>{children}<Lumen /></body>    </html>  );}
Loading interactive preview…

Overview

InstallSnippet guides developers from package installation to their first event in one self-contained card. Framework tabs (Next.js, React, Vue, and HTML with built-in marks by default) switch three numbered steps (Install, Add your key, and Ship) whose code blocks crossfade inside height-reserved containers with zero layout shift. Step 1 adapts automatically between a package manager switcher (npm, pnpm, yarn, bun) and a CDN script snippet. Clicking Generate key eases the {{key}} slot to the new key width in ch units and wipes the key into place.

Use InstallSnippet for post-signup quickstarts, empty-state dashboards awaiting a first event, and developer documentation landing pages. For a single standalone code block without onboarding steps, use Code. For managing multiple existing provider credentials, use Keys.

Usage

'use client'
import { InstallSnippet } from '@uthereal/ui/install-snippet'

export function SdkOnboarding() {
  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')
        const data = (await res.json()) as { key: string }
        return data.key
      }}
      onCopy={(step, value) => {
        console.info('Copied onboarding step', step, value.length)
      }}
    />
  )
}

Omit frameworks and generateKey to render the default four-framework sample SDK with a client-side simulated key generator (nothing is sent over the network).

Examples

Signed-in key and preferred package manager

Pass apiKey when the signed-in reader already has a publishable key. The snippets render the key immediately and hide the Generate key button. Set defaultPackageManager to start on a preferred CLI such as pnpm.

Get started in 30 seconds

Three steps to your first event.

v2.4.0
  1. Install

    Add the SDK to your project
    pnpm add @lumen/next
  2. Add your key

    Key created
    .env.local
    NEXT_PUBLIC_LUMEN_KEY=lmn_pub_7f3a9c2e4b8d1056
  3. Ship

    Deploy and watch events arrive
    app/layout.tsx
    import { Lumen } from "@lumen/next"; export default function RootLayout({ children }) {  return (    <html lang="en">      <body>{children}<Lumen /></body>    </html>  );}

Custom frameworks and hidden version

Replace frameworks with your own SDK tabs. Any framework ID outside next, react, vue, and html renders a clean text-only tab, and passing version={null} hides the version label in the header.

Install Beacon SDK

Capture server traces with zero agent overhead.

  1. Install

    Add the SDK to your project
    bun add @beacon/node
  2. Add your key

    Create a project key
    .env
    BEACON_WRITE_KEY=YOUR_API_KEY
  3. Ship

    Deploy and watch events arrive
    src/telemetry.ts
    import { createBeacon } from "@beacon/node"; export const beacon = createBeacon({  apiKey: process.env.BEACON_WRITE_KEY ?? "YOUR_API_KEY",  service: "billing-api",}); beacon.track("server.started");

Steps and key generation

Each step circle shows its step number and morphs into a check mark once completed.

StepTitleHeader controlCompletion trigger
1InstallPackage manager tabs or CDN filenameUser copies the install command or CDN tag
2Add your keyConfig filename + Generate key buttonUser generates a key, or copies the line once a key is ready
3ShipEntry filename with line-numbered codeUser copies the initialization snippet
  • Placeholder token: Place {{key}} anywhere inside step snippets. Until an API key exists, keyPlaceholder renders in an accent-tinted monospace slot and copies verbatim.
  • Live vs. simulated generation: Supply generateKey(signal) to call your key endpoint; rejections display an inline error message and switch the button to Try again. In-flight requests abort automatically on unmount or when a new request starts. When generateKey is omitted, the card generates a local simulated key and announces that nothing was sent.

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
titlestringDefault: "Get started in 30 seconds"Card heading text and accessible section name.
descriptionstringDefault: "Three steps to your first event."One-line subtitle under the title. Set to an empty string (or null in React) to hide it.
versionstring | nullDefault: "v2.4.0"Muted monospace label at the top-end corner, such as an SDK version. Pass null or an empty string to hide it.
frameworksInstallSnippetFramework[]Default: [{"id":"next","label":"Next.js","install":{"packages":"@lumen/next"},"key":{"file":".env.local","code":"NEXT_PUBLIC_LUMEN_KEY={{key}}"},"code":{"file":"app/layout.tsx","code":"import { Lumen } from \"@lumen/next\";\n\nexport default function RootLayout({ children }) {\n return (\n <html lang=\"en\">\n <body>{children}<Lumen /></body>\n </html>\n );\n}"}},{"id":"react","label":"React","install":{"packages":"@lumen/react"},"key":{"file":".env","code":"VITE_LUMEN_KEY={{key}}"},"code":{"file":"src/main.tsx","code":"import { createRoot } from \"react-dom/client\";\nimport { LumenProvider } from \"@lumen/react\";\nimport App from \"./App\";\n\ncreateRoot(document.getElementById(\"root\")!).render(\n <LumenProvider apiKey={import.meta.env.VITE_LUMEN_KEY}>\n <App />\n </LumenProvider>\n);"}},{"id":"vue","label":"Vue","install":{"packages":"@lumen/vue"},"key":{"file":".env","code":"VITE_LUMEN_KEY={{key}}"},"code":{"file":"src/main.ts","code":"import { createApp } from \"vue\";\nimport { lumen } from \"@lumen/vue\";\nimport App from \"./App.vue\";\n\ncreateApp(App)\n .use(lumen, { apiKey: import.meta.env.VITE_LUMEN_KEY })\n .mount(\"#app\");"}},{"id":"html","label":"HTML","install":{"file":"index.html","code":"<script src=\"https://cdn.lumen.dev/v2/lumen.min.js\" defer></script>"},"key":{"file":"index.html","code":"<meta name=\"lumen-key\" content=\"{{key}}\" />"},"code":{"file":"index.html","code":"<script>\n window.addEventListener(\"load\", () => {\n lumen.page();\n document.querySelector(\"#upgrade\").onclick = () =>\n lumen.track(\"upgrade_clicked\", { plan: \"pro\" });\n });\n</script>"}}]Framework tabs and their step snippets (install, key, code). Write {{key}} where the API key goes; ids next, react, vue, and html get built-in marks automatically.
defaultFrameworkstring—Initial framework tab ID when uncontrolled. Defaults to the first framework; edits do not reset a mounted instance.
defaultPackageManager'npm' | 'pnpm' | 'yarn' | 'bun'Default: "npm"Initial package manager used in step 1 when uncontrolled. Edits do not reset a mounted instance.
apiKeystring—Pre-populated API key shown in place of {{key}}. Hides the Generate key button for signed-in users who already have a key.
keyPlaceholderstringDefault: "YOUR_API_KEY"Tinted placeholder displayed wherever {{key}} appears until a key exists. Copies verbatim when copied before key generation.
generateKeyActionstring—Registered host action requested when the user clicks Generate key, Regenerate, or Try again.
recipestudio | softDefault: "studio"Visual treatment. Both recipes preserve interaction behavior.
themeInstallSnippetThemeDefault: {}Color mode, accent, and typed semantic token overrides.
motionnone | subtle | expressiveDefault: "subtle"Animation preset. System reduced-motion preferences take precedence.
motionOptionsInstallSnippetMotionOptionsDefault: {}Sliding tab highlight, snippet crossfade, and key-wipe timing overrides in milliseconds.
dirltr | rtl—Reading direction; inherited from the page when omitted.

InstallSnippetFramework accepts { id, label, install, key, code }, where install is { packages: string } or { file, code }, and key and code are { file, code }.

React integration

PropPurpose
frameworkControlled framework tab ID. Pair with onFrameworkChange.
onFrameworkChange(id)Called when the user selects a framework tab.
packageManagerControlled package manager ('npm' | 'pnpm' | 'yarn' | 'bun'). Pair with onPackageManagerChange.
onPackageManagerChange(id)Called when the user selects a package manager tab (useful for persisting choice across docs pages).
generateKey(signal)Async key creator returning Promise<string>. Reject to show the error state with Try again.
onKeyGenerated(key)Called with each newly created key string.
onCopy(step, value)Called after a successful copy with 'install' | 'key' | 'code' and the exact clipboard text.
onAction(action)Called when generateKeyAction is configured and the user activates Generate key, Regenerate, or Try again.
description, versionAlso accept null or "" in React to hide the subtitle or version label.
presetApplication defaults overridden by explicit instance arguments.
tokensCSS variables applied after the typed theme.
ref, className, styleApplied to the root <section> element.
Native attributesid, aria-*, data-*, and remaining <section> props forwarded to the root element.

Keyboard & accessibility

KeyAction
TabMoves between framework tabs, package manager tabs, copy buttons, and the Generate key button.
ArrowLeft / ArrowRightInside a tab list, moves focus to and selects the previous or next tab (respects RTL).
Home / EndInside a tab list, selects the first or last tab.
Enter / SpaceActivates a copy button or triggers key generation.

Framework and package manager switchers are real tablist controls with roving tabindex; the three-step <ol> serves as the framework tabpanel. Completed steps append visually hidden ", done" text to their <h4> headings alongside the check icon, so completion never relies on color alone. A pre-mounted polite role="status" live region announces framework switches, key generation progress, simulated-key notices, and errors.

Container queries adapt the card below 640px: at 460px and narrower, card padding tightens and package manager tabs display marks only (retaining aria-label names); at 380px and narrower, framework tabs hide their marks to keep labels legible and hide the version tag. Code blocks scroll horizontally inside their container (dir="ltr") while surrounding card chrome mirrors cleanly in RTL (dir="rtl"). forced-colors: active maps borders, tab indicators, step circles, key slots, and focus outlines to system colors.

Motion & theming

Tab highlights slide to the measured tab on a bounce-free 240ms spring. Snippets, filenames, and step descriptions crossfade inside a shared grid cell (100ms out, 160ms in with a 2px rise) while every code block reserves the height of the tallest framework snippet so nothing jumps. Generating a key eases the slot width in ch units while wiping the key in over 340ms and fading the accent tint out. Under prefers-reduced-motion: reduce, slides, rises, and clip-path wipes are replaced with 120ms opacity crossfades. Setting motion="none" makes every transition immediate (0ms).

theme accepts mode, accent, and typed tokens across these groups:

Token groupCSS custom properties
core--ui-surface, --ui-surface-raised, --ui-text, --ui-text-secondary, --ui-muted, --ui-border, --ui-highlight, --ui-accent, --ui-accent-foreground, --ui-danger, --ui-focus-ring, --ui-radius, --ui-font, --ui-font-size, --ui-font-weight
extended--ui-surface-sunken, --ui-border-strong, --ui-border-subtle
shape--ui-radius-sm, --ui-popup-radius, --ui-surface-radius
type--ui-font-mono, --ui-font-display
series--ui-series-1, --ui-series-2, --ui-series-3, --ui-series-4 (softened toward --ui-text for lightweight syntax highlighting)

An application-wide UtherealProvider supplies defaults.

Composition

In an agent composition, InstallSnippet is a leaf. Provide frameworks with {{key}} placeholders and wire generateKeyAction to a registered host action. See Building with agents.

{
  "type": "InstallSnippet",
  "props": {
    "title": "Get started in 30 seconds",
    "description": "Three steps to your first event.",
    "version": "v2.4.0",
    "defaultPackageManager": "pnpm",
    "keyPlaceholder": "YOUR_API_KEY",
    "generateKeyAction": "generate_sdk_key"
  },
  "children": []
}

On this page