Skip to main content
These examples use React 18 or later and the browser fetch. They need no API key and no Kash SDK.

Iframe component

KashEmbed.tsx

Hook for iframe events

useKashEmbedEvents.ts

Custom market grid with live prices

This component builds its own grid from the JSON API. It loads a thread’s markets once, refreshes the prices every 10 seconds from /api/markets/state, and adds a “Predict on X” button to each outcome.
ThreadMarketGrid.tsx
The deep-link endpoint writes outcomes beyond the first two as Outcome N in the tweet. For markets with more than two outcomes, link to the market page instead, or build the links server-side with POST /api/twitter-links, which uses the real labels.

Next.js (App Router)

The iframe is plain HTML, so it renders on the server with no client code. To fetch data, call the API from a Server Component and let Next cache it:
app/markets/page.tsx

Next steps

JavaScript examples

A framework-free client

HTML examples

Copy-paste pages