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.
NextJS Starter Kit
Minimal NextJS template for Trails with Earn, Swap, Pay, and Fund modes integrated.
Get an API key: Sign up and create an API key on the Trails Dashboard
Prerequisites
- React 18+ (React 19.1+ recommended for best compatibility)
Install
Focused components (recommended)
The SDK exportsPay, Fund, Swap, Withdraw, and Earn as purpose-built alternatives to TrailsWidget. Pick the component that matches what you’re building.
Pay
User pays a specific amount to a specific recipient:Swap
User swaps from one token to another:Fund
User deposits funds into a wallet or protocol:Withdraw
User withdraws or off-ramps tokens:Earn
User deposits into DeFi protocols for yield:Lifecycle events
All focused components expose consistent lifecycle callbacks. ReplaceXxx with Payment, Funding, Swap, Withdraw, or Earn:
Script import
For non-React sites, embed the widget via CDN:- unpkg:
https://unpkg.com/0xtrails@latest/dist/umd/trails.min.js - jsDelivr:
https://cdn.jsdelivr.net/npm/0xtrails@latest/dist/umd/trails.min.js
Pin to a specific version (e.g.
@1.5.0) in production instead of @latest.Available modes
Detailed configuration: Pay · Fund · Swap · Withdraw · Earn
If you need hooks: wrap your app with
TrailsProvider. See the Hooks documentation.