This recipe covers adding Phantom Connect to a Next.js + React app. Use their Browser SDK for
non-React web apps and the React Native SDK
for mobile apps.
Prerequisites
Create a Phantom Portal app, configure allowed domains and redirect URLs, and copy the App ID.Step-by-step (Next.js + React)
1
Install the React SDK
Use the React SDK for Next.js + React.
Install dependencies
Install dependencies
Optional starter template
Optional starter template
2
Add PhantomProvider (App Router or Pages Router)
Wrap your root layout so Phantom Connect can manage auth and wallet state.
Put your App ID in
config.appId (see appId: "your-app-id" in the examples)
and set the redirect URL you configured.- App Router
- Pages Router
Create a client-side provider component, then wrap it in
app/layout.tsx.app/providers.tsx
app/providers.tsx
app/layout.tsx
app/layout.tsx
3
Connect a user
Use the built-in modal or ConnectButton to trigger the Phantom flow.
Connect with the modal
Connect with the modal
4
Theme the Phantom ConnectUI
Use theming to customize
the modal UI.