> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whop.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Agent mode: https://docs.whop.com/cli/agent-mode.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# CardDetailsElement

> One card and what has been spent on it: the card itself, what it has spent against its limit, and its latest transactions. Opens as a drawer. The card face, its reveal and its lock come from the `whopCard` element composed inside, so a host gets one surface rather than assembling three. Pressing a transaction, or asking for the full list, reports the request — the drawer never navigates.

> [!NOTE]
>
> This page documents `@whop/elements@1.9.0` and `@whop/elements-react@1.9.0`.

*Since `v1.0.0`.*

Opens as a modal from [`Wallet`](https://docs.whop.com/elements/latest/wallet/overview): `wallet.createOverlay('cardDetails')`. Pass props and callbacks in the create options.

> [!NOTE]
>
> This element is **modal-only**. Open it with `createOverlay`; it has no inline mount.

```tsx React theme={null}
import { WhopElements, Wallet, CardDetailsElement } from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

function Example() {
  return (
    <WhopElements elements={loadWhop()}>
      <Wallet /* options */>
        <CardDetailsElement onTransactionSelected={(e) => console.log(e)} onAllTransactionsRequested={(e) => console.log(e)} onTopUpRequested={(e) => console.log(e)} onCloseRequested={(e) => console.log(e)} onMenuRequested={(e) => console.log(e)} />
      </Wallet>
    </WhopElements>
  );
}
```

```html JavaScript theme={null}
<script src="https://cdn.whop.com/elements/amber/elements.js" data-whop-elements></script>
<script type="module">
  const wallet = window.WhopElements().wallet.create({ /* options */ });
  wallet.createOverlay('cardDetails', {
    onTransactionSelected: (e) => console.log(e),
    onAllTransactionsRequested: (e) => console.log(e),
    onTopUpRequested: (e) => console.log(e),
    onCloseRequested: (e) => console.log(e),
    onMenuRequested: (e) => console.log(e)
  }).open();
</script>
```

Example data. [Open the Playground](https://docs.whop.com/elements/latest/wallet/overview#playground).

## Props

**accessToken** `string`

A scoped token for the card and its transactions — needs `payout:account:read`. Omitted, calls carry the viewer's own session, which only answers same-origin.

**card** `object`

Non-sensitive card metadata a host has already loaded. Supplying it saves the card face a list request; its authorized secrets are still fetched so the reveal stays instant.

**properties**

**id** `string` *required*

**name** `string | null` *required*

**status** `string | null` *required*

One of `"active"`, `"frozen"`, `"canceled"`, `"invited"`, `"denied"`, or `null`.

**last4** `string | null` *required*

**billing** `Billing | null` *required*

**properties**

**city** `string | null` *required*

Billing city.

**country\_code** `string | null` *required*

Billing country code.

**line1** `string | null` *required*

Street address line 1.

**line2** `string | null` *required*

Street address line 2.

**postal\_code** `string | null` *required*

Billing postal code.

**region** `string | null` *required*

Billing region or state.

**expiration\_month** `string | null` *required*

**expiration\_year** `string | null` *required*

**cardId** `string`

The card this drawer describes, prefixed `icrd_`. Defaults to `""`.

**latestCount** `number`

How many recent transactions to list under the card. Defaults to `5`.

**hideTransactions** `boolean`

Hide the latest-transactions list, for a host that shows its own beneath the drawer. Defaults to `false`.

**hideMenuButton** `boolean`

Hide the overflow button, for a host with no card actions of its own to offer. Defaults to `false`.

## Events

Pass callbacks in the create options or React props.

### `onTransactionSelected`

A transaction in the drawer was pressed.

**payload** `object`

**properties**

**transactionId** `string` *required*

### `onAllTransactionsRequested`

View all was pressed. Open your own full transaction surface — the drawer never navigates.

**payload** `object`

**properties**

**cardId** `string` *required*

### `onTopUpRequested`

Top up was pressed. Present your own funding surface, such as the wallet's deposit element.

**payload** `object`

**properties**

**cardId** `string` *required*

### `onCloseRequested`

Close was pressed. Dismiss the surface you opened the drawer in — the drawer never closes itself.

**payload** `object`

**properties**

**cardId** `string` *required*

### `onMenuRequested`

The overflow button was pressed. Present your own card actions menu.

**payload** `object`

**properties**

**cardId** `string` *required*

### `onLoaderStart`

Runs after the loading skeleton first paints and before `onReady`.

### `onReady`

Runs after the element's first complete paint.

### `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.

**e** `object`

**properties**

**message** `string` *required*

**code** `string`

**sourceKey** `string`

## 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.

**Parameters**

**target** `string | HTMLElement` *required*

### `destroy`

Removes the element and releases its frame and subscriptions. You can call it more than once. React removes the element automatically.

### `update`

Merges new props into the mounted element. In React, change the component props instead.

**Parameters**

**options** `Partial\<CardDetailsElementProps\>` *required*

## 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.

| Class | Targets |
| - | - |
| `.whop-CardDetailsSurface` | The card drawer |
| `.whop-CardSurface` | The card, controls, and revealed details |

```ts theme={null}
const wallet = whop.wallet.create({
  appearance: {
    classes: {
      'whop-CardDetailsSurface': { borderRadius: '8px', fontWeight: '600' },
      'whop-CardSurface': { borderRadius: '8px', fontWeight: '600' }
    }
  }
});

wallet.update({
  appearance: {
    classes: { 'whop-CardDetailsSurface': { fontWeight: '700' } }
  }
});
```

In React, pass `appearance` to `<Wallet>`. Set it globally with `WhopElements({ appearance })`.


## Related topics

- [Wallet](https://docs.whop.com/elements/latest/wallet/overview.md)
- [ActivityDetailElement](https://docs.whop.com/elements/latest/wallet/activityDetail.md)
- [CardElement](https://docs.whop.com/elements/latest/payments/card.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.