> ## 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. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md 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. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md 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.

# DmsListElement (Legacy)

> Referentie voor de legacy DmsListElement. Gebruik voor nieuwe integraties ChannelListElement uit @whop/elements.

## Overzicht

Een UI-element dat een lijst met DM's weergeeft.

## Gebruik

### Basisgebruik

```typescript theme={null}
// Create the element
const element = session.createElement("dms-list-element", {
  onReady: (element) => {
    console.log("Dms list element is ready");
  },
});

// Mount it to a container
element.mount("#dms-list-container");
```

### Luisteren naar events

```typescript theme={null}
const element = session.createElement("dms-list-element", {});

element.on("ready", () => {
  console.log("Dms list element is ready");
});

element.on("channelSelected", (ev) => {
  console.log("Channel selected:", ev.detail.id);
});

element.mount("#dms-list-container");
```

```typescript theme={null}
const element = session.createElement("dms-list-element", {
  onReady: (element) => {
    console.log("Dms list element is ready");
  },
});
```

## Events

Events die door de DmListElement worden uitgezonden.

Luister naar deze events met de methode `on()` of door callbackfuncties mee te geven in de opties.

### `error`

Wordt uitgezonden wanneer er een fout optreedt tijdens de initialisatie of werking van het element.

**Callbacksignatuur:** (error: `unknown`) => void

### `ready`

Wordt uitgezonden wanneer het element klaar is met laden en gereed is voor interactie met de gebruiker.

**Callbacksignatuur:** (element: `DmsListElement`) => void

### `optionsUpdated`

Wordt uitgezonden wanneer de opties van het element worden bijgewerkt via `updateOptions()`.

**Callbacksignatuur:** (options: [`DmsListElementOptions`](#dmslistelementoptions)) => void

### `snapshot`

Wordt uitgezonden wanneer de interne status van het element verandert.

**Callbacksignatuur:** (snapshot: [`DmsListElementSnapshot`](#dmslistelementsnapshot)) => void

### `channelSelected`

Wordt uitgezonden wanneer de gebruiker op een kanaal klikt.

**Callbacksignatuur:** (ev: `CustomEvent`\<\{ id: `string`; }>) => void

## Methoden

### `mount(container)`

Koppel het element aan een DOM-container.

De container moet een leeg element zijn. Het element wordt als child toegevoegd.
Als het element al gekoppeld is, logt deze methode een waarschuwing en keert terug.

| Parameter | Type | Beschrijving |
| - | - | - |
| `container` | `HTMLElement` \| `#$\{`string`\}` | Het containerelement of een CSS-selector die begint met '#' |

```typescript theme={null}
// Using a selector
element.mount("#my-container");

// Using an element reference
const container = document.getElementById("my-container");
element.mount(container);
```

### `unmount()`

Verwijder het element uit de DOM en ruim alle event listeners op.

Na het ontkoppelen mag de elementinstantie niet opnieuw worden gebruikt.
Maak een nieuwe elementinstantie aan als je opnieuw wilt koppelen.

```typescript theme={null}
// Unmount when done
element.unmount();

// Commonly used in event handlers
element.on("complete", () => {
  element.unmount();
});
```

### `updateOptions(options)`

Werk de configuratieopties van het element bij na het aanmaken.

Alleen de opgegeven opties worden bijgewerkt; andere opties blijven ongewijzigd.
Het element wordt opnieuw gerenderd met de nieuwe opties.

| Parameter | Type | Beschrijving |
| - | - | - |
| `options` | `Partial`\<[`DmsListElementOptions`](#dmslistelementoptions)> | Gedeeltelijk optie-object met de waarden die moeten worden bijgewerkt |

```typescript theme={null}
// Update a single option
element.updateOptions({
  onComplete: (ev) => {
    console.log("New handler!");
  },
});
```

### `getSnapshot()`

Haal de huidige status-snapshot van het element op.

De snapshot bevat de huidige interne status van het element, zoals
de laadstatus, formulierwaarden of andere elementspecifieke gegevens.

**Retourneert:** [`DmsListElementSnapshot`](#dmslistelementsnapshot)

```typescript theme={null}
const snapshot = element.getSnapshot();
console.log("Current state:", snapshot.state);

// Or listen for changes
element.on("snapshot", (snapshot) => {
  console.log("State changed:", snapshot);
});
```

## Styling

Pas dit element aan met `appearance.classes`. Zie de [stylingreferentie](https://docs.whop.com/nl/sdk/elements/styling-reference.md) voor de volledige lijst met stabiele klassenamen en voorbeeldsnippets.

## Types

### DmsListElementOptions

Configuratieopties voor de DmsListElement.

| Eigenschap | Type | Verplicht | Standaard | Beschrijving |
| - | - | - | - | - |
| `companyId` | `string \| undefined` | Nee | - | De account-ID waarop de kanalen worden gefilterd. |
| `selectedChannel` | `string \| undefined` | Nee | - | De ID van het momenteel geselecteerde kanaal. |
| `emptyState` | `EmptyStateOptions \| undefined` | Nee | - | Aangepaste lege status die wordt weergegeven wanneer er geen kanalen zijn. |
| `onReady` | `((element: DmsListElement) => void) \| undefined` | Nee | - | Callback die wordt aangeroepen wanneer het element klaar is met laden en gereed is voor interactie. Dit is gelijk aan luisteren naar het event 'ready'. |
| `onEvent` | `((event: DmsListElementEvent) => void) \| undefined` | Nee | - | Callback die wordt aangeroepen wanneer een event van het DM-lijstelement wordt uitgezonden. |

### DmsListElementSnapshot

Vertegenwoordigt de huidige status van de DmsListElement.

Gebruik `element.getSnapshot()` om de huidige status op te halen, of luister naar het event `snapshot` voor wijzigingen.

| Eigenschap | Type | Verplicht | Standaard | Beschrijving |
| - | - | - | - | - |
| `state` | `"ready" \| "loading"` | Ja | - | De huidige laadstatus van het element. - '"loading"' - Het element wordt geïnitialiseerd - '"ready"' - Het element is volledig geladen en interactief |
