Live Demo
Try the Trails widget live. Configure, preview, and copy code.
React Starter Kit
Minimal template for Trails with Earn, Swap, Pay, and Fund modes integrated.
Prerequisites
- React 18+ (18.0 or newer)
- wagmi 2.16+
1
Install the SDK
2
3
Handle Events (Optional)
You can listen to various events during the transaction flow:
Available Modes
The widget supports several modes for different use cases:pay
- Exact output amount (user pays exactly what’s specified)fund
- Deposit/top-up (user chooses amount to send)swap
- Cross-chain token swappingearn
- Integrated yield farming and staking - bundled with existing integrationsreceive
- Request payments via QR code
Script Import
While we recommend using the React component, you can also embed via a script tag in a non-React site. You can load the Trails widget from various CDNs:CDN Recommendations
- unpkg:
https://unpkg.com/0xtrails@latest/dist/umd/trails.min.js
- jsDelivr:
https://cdn.jsdelivr.net/npm/0xtrails@latest/dist/umd/trails.min.js
- Specific Version: Replace
@latest
with@1.0.0
(or your desired version) for production use
For production applications, we recommend pinning to a specific version rather than using
@latest
to ensure consistent behavior.