Skip to main content
A Next.js 14+ app-router integration that mounts the Velora Widget at /swap. The widget reads window and localStorage on mount, so it must be client-only. We use next/dynamic with ssr: false.

File tree

Install

src/app/layout.tsx

src/app/swap/widget.tsx

The widget itself, wrapped in dynamic(... { ssr: false }).

src/app/swap/page.tsx

.env.local

Restart next dev after creating or changing .env.local.

Run it

Visit http://localhost:3000/swap. You should see the widget render with Connect Wallet in the header.

Why ssr: false?

The widget reads window, localStorage, and prefers-color-scheme on mount. None of those exist during server rendering. dynamic(... { ssr: false }) defers the import to the browser, so the widget only ever runs client-side. If you forget ssr: false, you’ll see a hydration-mismatch error or a window is not defined exception.

With dApp-mode wallet

If your app already manages the wallet (wagmi, RainbowKit, or any other host-side wallet library), switch to dApp mode and pass the provider:
See Wallet management for the full pattern.
Last modified on June 14, 2026