Skip to main content
The NetworkSelector component provides a user-friendly dropdown interface for selecting networks supported by the Compound III protocol. It displays network icons, names, and handles network switching.

Usage

Props

Example

Features

The NetworkSelector component includes the following features:
  • Network List: Displays a list of supported networks
  • Network Icons: Shows icons for each network
  • Network Names: Displays the name for each network (e.g., Ethereum, Base)
  • Network Switching: Optionally switches the connected wallet to the selected network
  • Testnet Support: Optionally shows testnet networks
  • Current Network Indicator: Highlights the currently connected network
  • Keyboard Navigation: Supports keyboard navigation for accessibility
  • Loading States: Shows loading indicators during network switching
  • Error Handling: Displays user-friendly error messages

Supported Networks

The component supports all networks where Compound III is deployed, including:
  • Ethereum Mainnet (Chain ID: 1)
  • Base (Chain ID: 8453)
  • Arbitrum (Chain ID: 42161)
  • Polygon (Chain ID: 137)
  • And their corresponding testnets when showTestnets is enabled

Loading and Error States

The component handles loading and error states automatically:
  • While switching networks, a loading indicator is displayed
  • If an error occurs during network switching, an error message is displayed
  • If the user rejects the network switch, an appropriate message is shown

Customization

You can customize the appearance of the component using the className prop: