Skip to main content

Token Selection

This example demonstrates how to build React components for selecting source chains and tokens, including filtering tokens by balance.

Overview

A bridge interface typically needs:
  1. A chain selector dropdown
  2. A token selector with search and balance display
  3. State management to connect selections to the quote system

Chain Selection Component

This component displays available source chains with logos and names.

Token Selection Component

This component displays available tokens for a selected chain with balance information.

Using with State Management

Here’s how to combine these components with React state:
BridgeForm.tsx

Using the useTokenBalance Hook

For individual token balance display, use the useTokenBalance hook:
SingleTokenBalance.tsx

Best Practices

When building token selectors, consider these UX best practices:
  1. Show tokens with balances at the top of the list
  2. Include token logos for visual recognition
  3. Display both symbol and name for clarity
  4. Show USD values when available
  5. Add search functionality for chains with many tokens
  6. Disable the token selector until a chain is selected

Next Steps

Quote Display

Show quote details and fees

Full Integration

Complete bridge widget