Components
Account
Connected-account button with a panel for balance, copy, explorer link, account switching and disconnect.
The button shows the connected account’s avatar and ENS name, or its truncated address. It opens a panel with the balance, current network, copy, explorer link and disconnect. It renders nothing while disconnected.
Installation
Section titled “Installation”npx shadcn@latest add @0xui/accountpnpm dlx shadcn@latest add @0xui/accountyarn dlx shadcn@latest add @0xui/accountbunx --bun shadcn@latest add @0xui/accountimport { Account } from "@/components/account";
<Account />;To show “Connect wallet” while disconnected as well, use Wallet Button.
Examples
Section titled “Examples”Balance in the trigger
Section titled “Balance in the trigger”<Account showBalance />Switch account
Section titled “Switch account”wagmi can hold several wallet connections at once. When more than one wallet is connected, the panel lists the others under “Switch account”. Picking one makes it the current account for the whole app. Disconnect only disconnects the current wallet.
There is nothing to configure: the list appears once a second wallet connects, for example through Connect Wallet.
Accounts inside one wallet are switched in the wallet itself. wagmi follows the change, and the button updates.
Extra panel content
Section titled “Extra panel content”Children render at the bottom of the panel, above disconnect:
<Account> <a href="/settings">Settings</a></Account>Headless
Section titled “Headless”import { useConnectedAccount } from "@/components/account";
const { address, ensName, displayName, chain, connector, disconnect } = useConnectedAccount();
// With several wallets connected:const { otherAccounts, switchAccount, isSwitching } = useConnectedAccount();otherAccounts.map(({ address, connector }) => switchAccount(connector));| Prop | Type | Default | Description |
|---|---|---|---|
open / defaultOpen / onOpenChange |
— | — | Control the panel. |
showBalance |
boolean |
false |
Show the native balance in the trigger. |
onDisconnect |
() => void |
— | Called after disconnecting. |
children |
ReactNode |
— | Extra panel content. |
