Skip to main content
Cards is available in sandbox only while we finish development. Dakota enables Cards per account. The Cards endpoints are in the API reference, marked Sandbox only. Endpoints, fields, and flows can still change before release.
The package has three entry points:
  • @dakota-xyz/cards-js — the framework-free core.
  • @dakota-xyz/cards-js/react — the React binding. It needs react >= 18.
  • @dakota-xyz/cards-js/styles.css — the default stylesheet.
This page documents the public surface. For task-oriented guidance, see the integration guide and theming.

@dakota-xyz/cards-js (core)

class DakotaCards

The client. Create one per app and reuse it.

class CardDetailsHandle

Controls one card. Get it from cards.cardDetails(...) — you do not construct it yourself.

Events

CardDetailsEvents maps each event name to its payload.
Errors are not delivered as events. mount() and reveal() reject with a DakotaCardsError, so handle them with try/catch. cardDetails() throws invalid_theme synchronously when a theme value is not concrete.

Sessions

Errors

The SDK creates these errors. You catch them — you do not construct them. See the error-code table for when each code occurs and which codes are retryable.

Theming & strings types

See theming for defaults and behaviour.

@dakota-xyz/cards-js/react

The React entry point re-exports DakotaCards, CardDetailsHandle, and the card types its own signatures use. Import FetchSession, the error types, and the theming types from the core entry point.

<DakotaCardsProvider>

Supplies a DakotaCards client to the component tree.

useDakotaCards()

Returns the client from the nearest provider. Throws if it is used outside one.

<CardDetails> and useCardDetails

<CardDetails> renders the .dk-card recipe and exposes reveal and mask through a ref.
<CardDetails> always renders all four value slots and their captions from the .dk-card recipe. fields only selects which of those slots the SDK binds — mounts the masked face into, and reveals. Slots you omit still render, as empty captioned placeholders. To render a genuinely partial layout, with fewer slots on the page, use the headless useCardDetails hook and lay out only the fields you want. useCardDetails is the headless form: you render the recipe yourself and wire the refs.
When you render your own markup, some CSS rules are load-bearing. See Custom markup.