Skip to content

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.

Terminal window
npx shadcn@latest add @0xui/account
import { Account } from "@/components/account";
<Account />;

To show “Connect wallet” while disconnected as well, use Wallet Button.

<Account showBalance />

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.

Children render at the bottom of the panel, above disconnect:

<Account>
<a href="/settings">Settings</a>
</Account>
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.