AssetSelector component provides a user-friendly dropdown interface for selecting assets available in the Compound III protocol. It displays asset icons, symbols, and optional balance information.
Usage
Props
Example
Features
TheAssetSelector component includes the following features:
- Asset List: Displays a list of available assets in the protocol
- Asset Icons: Shows icons for each asset
- Asset Symbols: Displays the symbol for each asset (e.g., USDC, ETH)
- User Balances: Optionally shows the user’s balance for each asset
- Search: Allows users to search for assets by symbol or name
- Filtering: Supports filtering assets based on custom criteria
- Keyboard Navigation: Supports keyboard navigation for accessibility
- Loading States: Shows loading indicators while fetching asset data
- Error Handling: Displays user-friendly error messages
Loading and Error States
The component handles loading and error states automatically:- While asset data is being fetched, a loading indicator is displayed
- If an error occurs during data fetching, an error message is displayed
Customization
You can customize the appearance of the component using theclassName prop:
Related Components
- SupplyForm - Uses AssetSelector for selecting assets to supply
- WithdrawForm - Uses AssetSelector for selecting assets to withdraw
- NetworkSelector - For selecting supported networks