Skip to main content
This page documents @whop/elements@1.0.0-beta.0 and @whop/elements-react@1.0.0-beta.0.
Pre-release, not yet part of a stable release.
Mounts inside Balances, in Wallet. accountId comes from Wallet. Pass props and callbacks through the create options or React props.

Example data. Open the Playground.

Props

string
A scoped token for the read. An account needs company:balance:read; a user’s holdings or owned-account list needs user:balance:read. Mint it on your server with POST /api/v1/access_tokens. Without it the read uses the viewer’s own session, which only works same-origin.
boolean
For a user’s user_… account, list their personal balance followed by every owned account the backend returns instead of listing the holdings inside their personal account. Ignored for an account. Defaults to false.
boolean
Show each row in the currency it is held in (€4.20, 0.00000009 cbBTC) and put the dollar value underneath. Off by default, so every row is in dollars. Defaults to false.
boolean
Keep the dollar value under a holding shown in its own currency. Only applies when showSourceCurrency is on. Defaults to true.
boolean
Keep the personal row when includeOwnedAccounts is on. Turn it off if your app has no personal account to open. Defaults to true.

Events

Pass callbacks in the create options or React props.

onBalanceSelected

A holding row was clicked, with includeOwnedAccounts off. key is usd for the combined dollar row, otherwise the holding symbol (cbBTC, EUR), and kind tells you which of the three it is so you can route without classifying symbols yourself. The element never navigates.Signature: ((payload: { key: string; kind: "usd" | "cash" | "asset"; }) => void)

onAccountSelected

An account row was clicked, with includeOwnedAccounts on. accountId is the personal user_… tag or an owned biz_… tag, and kind lets you route without inspecting it. The element never navigates.Signature: ((payload: { accountId: string; kind: "personal" | "business"; }) => void)

onLoaderStart

Runs after the loading skeleton first paints and before onReady.Signature: (() => void)

onReady

Runs after the element’s first complete paint.Signature: (() => void)

onError

Runs when the element fails to load or crashes. The fallback remains visible. Use code for programmatic handling. sourceKey identifies a failed host-state source.Signature: ((e: { message: string; code?: string | undefined; sourceKey?: string | undefined; }) => void)

Methods

Call these on the handle returned by create, or through a React ref.

mount

Mounts the element in target and starts loading. React components mount themselves.Signature: (target: string | HTMLElement) => void

destroy

Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.Signature: () => void

update

Merges new props into the mounted element. In React, change the component props instead.Signature: (options: Partial<ListElementProps>) => void

Styling

Style these parts through appearance.classes. Use camel case or kebab case for property names and include units. Page stylesheets can’t reach the element’s frame. The framework validates each declaration before injecting it.
In React, pass appearance to <Wallet>. Set it globally with WhopElements({ appearance }).