Components
Token Icon
Token logo with fallbacks and an optional chain badge.
Tries three sources in order: your src URL (a token list’s logoURI; ipfs:// works), the built-in icon for the symbol, then the symbol’s first two letters. List logos go dead often, so each step falls through to the next.
Installation
Section titled “Installation”npx shadcn@latest add @0xui/token-iconpnpm dlx shadcn@latest add @0xui/token-iconyarn dlx shadcn@latest add @0xui/token-iconbunx --bun shadcn@latest add @0xui/token-iconimport { TokenIcon } from "@/components/token-icon";
<TokenIcon symbol="USDC" />;
// With a token list<TokenIcon symbol={token.symbol} src={token.logoURI} />;Examples
Section titled “Examples”With chain badge
Section titled “With chain badge”The same token on different chains is easy to mix up. chainId adds the chain’s logo in the corner.
<TokenIcon symbol="USDC" chainId={8453} size={40} />| Prop | Type | Default | Description |
|---|---|---|---|
symbol |
string |
— | Token symbol. Used for the built-in icon, the fallback and the accessible label. |
src |
string |
— | Logo URL, e.g. token.logoURI. Takes priority over the built-in icon. |
gateway |
string |
https://ipfs.io/ipfs/ |
IPFS gateway for ipfs:// logos. |
chainId |
number |
— | Show this chain’s logo as a corner badge. |
size |
number |
24 |
Diameter in px. |
variant |
"background" | "branded" | "mono" |
"branded" |
Style of the built-in icons. |
