# Wallet Button

> One button for the whole wallet lifecycle. Connect, restore, account.

- Install: `npx shadcn@latest add @0xui/wallet-button`
- Registry JSON: https://0xui.io/r/wallet-button.json
- Source: https://github.com/fimbul-lab/0xui/blob/main/registry/default/components/wallet-button.tsx

The wallet button most apps need in their header. It shows "Connect wallet" when disconnected and the [Account](https://0xui.io/components/account.md) 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".

## Installation

```bash
npx shadcn@latest add @0xui/wallet-button
```

## Usage

```tsx
import { WalletButton } from "@/components/wallet-button";

<WalletButton />;
```

Pass props through to either state:

```tsx
<WalletButton
  connect={{ title: "Sign in", onConnect: track }}
  account={{ showBalance: true }}
/>
```

## States

| Phase | What the user sees |
| --- | --- |
| `restoring` | Skeleton the size of the button: during server render and while wagmi reconnects. |
| `disconnected` | [Connect Wallet](https://0xui.io/components/connect-wallet.md) button. |
| `connected` | [Account](https://0xui.io/components/account.md) button. |

`useWalletButtonPhase()` returns the current phase.

## Props

| 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. |
