This example demonstrates how to use the @phantom/react-sdk package to create a connect modal with built-in mobile deeplink support.
- 🖥️ Desktop Support: Traditional web-based wallet connection
- 📱 Mobile Support: Automatic mobile device detection with deeplink button
- 🔗 Deeplink Integration: Redirects to Phantom mobile app via phantom.com/ul
- 🎨 Styled Modal: Pre-built, customizable connection modal
- ⚡ React Hooks: Simple integration with React components
When accessed on a mobile device, the connect modal will show an additional "Open in Phantom App" button that:
- Detects if the user is on a mobile device
- Shows a mobile-specific connect button
- Redirects to
https://phantom.com/ul/browse/[current_url] - Phantom's universal link system handles opening the mobile app
-
Install dependencies:
yarn install
-
Build the required packages:
yarn predev
-
Start the development server:
yarn dev
-
Open your browser to http://localhost:5178
To test the mobile functionality:
- Desktop: Use browser dev tools to simulate a mobile device
- Mobile: Visit the URL on your phone and test the deeplink behavior
- Device Info: Click "Show Device Info" to see detection details
App.tsx- Main app with PhantomProvider setupConnectExample.tsx- Connection demo component with device detection- Uses
@phantom/react-sdkfor the modal UI and ConnectButton component - Uses
@phantom/browser-sdkfor mobile device detection
The example uses these default settings:
- Provider Type: "embedded"
- Address Types: Solana + Ethereum
- API Base URL: Development environment
- Theme: Light mode
You can modify these in App.tsx to test different configurations.