@layerswap/widget-react — a thin React loader that fetches the widget at runtime from Layerswap’s signed CDN. The widget code and its heavy dependencies (wallet SDKs, animation and form libraries) never enter your bundle: your app installs only the loader, and widget updates roll out automatically without you redeploying.
Need to control the complete bundle? See Self-bundled Widget. Existing self-bundled integrations can follow the migration guide.
Install
react and react-dom (18 or 19) are the only required peer dependencies. wagmi is an optional, types-only peer — install it only if you pass a wagmiConfig prop. Everything else the widget needs ships inside the CDN remote.
Render the widget
YOUR_API_KEY identifies your app to the Layerswap API. Generate one in the Partner Dashboard.
That’s the complete minimum integration. Compared with the self-bundled Widget, note what’s not here:
- No CSS import — the widget injects its styles at runtime.
- No provider wrapper and no wallet provider setup — the widget builds its wallet providers internally. You can filter chains or supply credentials via props.
- No bundler configuration — no polyfills, no
transpilePackages, nonext/dynamic. It works in the Next.js App Router as-is: the component declares"use client", the server renders onlyfallback, and the loader starts after hydration.
Things to know
Keep object props referentially stable.
config, callbacks, walletDefaults, and walletProvidersConfig are compared by identity. Recreating them causes avoidable provider-list rebuilds and re-renders. Hoist them to module scope or wrap them in useMemo.className, style, or size props — wrap it in a container that constrains its width:
Versioning
Pinning an exact CDN build is not a public API. See Widget delivery and security for the delivery and verification pipeline.Next steps
Configuration
The
config prop — API key, network set, theme, initial valuesWidget delivery and security
CDN delivery, manifest signing, CSP, and failure modes
Wallets
Filter chains, supply WalletConnect/TON credentials, share your wagmi config
Deposit Widget
Fixed-destination deposit flow with
LayerswapDepositWidgetEvent Callbacks
React to swap lifecycle events via the
callbacks propOther frameworks
Vue, Angular, Svelte, or plain DOM with
@layerswap/widget-jsProduction checklist
Environment, CSP, error handling, release, and monitoring checks