Components
Wallet Button
One button for the whole wallet lifecycle. Connect, restore, account.
The wallet button most apps need in their header. It shows “Connect wallet” when disconnected and the Account button when connected. While wagmi restores a previous connection on page load, it shows a placeholder, so returning users never see a flash of “Connect wallet”.
Restoring wallet connection
Installation
Section titled “Installation”npx shadcn@latest add @0xui/wallet-buttonpnpm dlx shadcn@latest add @0xui/wallet-buttonyarn dlx shadcn@latest add @0xui/wallet-buttonbunx --bun shadcn@latest add @0xui/wallet-buttonimport { WalletButton } from "@/components/wallet-button";
<WalletButton />;Pass props through to either state:
<WalletButton connect={{ title: "Sign in", onConnect: track }} account={{ showBalance: true }}/>States
Section titled “States”| Phase | What the user sees |
|---|---|
restoring |
Skeleton the size of the button: during server render and while wagmi reconnects. |
disconnected |
Connect Wallet button. |
connected |
Account button. |
useWalletButtonPhase() returns the current phase.
| Prop | Type | Description |
|---|---|---|
connect |
ConnectWalletProps |
Props for the connect button and picker. |
account |
AccountProps |
Props for the account button and panel. |
className |
string |
Applied in every state. |
