{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "wallet-button",
  "title": "Wallet Button",
  "description": "The one wallet button for an app header: ConnectWallet when disconnected, Account when connected, and a skeleton placeholder (skullet) during SSR and while wagmi restores a previous connection, so returning users never see a flash of 'Connect wallet'. Exports useWalletButtonPhase (restoring | disconnected | connected).",
  "dependencies": [
    "wagmi",
    "skullet"
  ],
  "registryDependencies": [
    "@0xui/connect-wallet",
    "@0xui/account",
    "@0xui/use-mounted"
  ],
  "files": [
    {
      "path": "registry/default/components/wallet-button.tsx",
      "content": "// Docs: https://0xui.io/components/wallet-button.md\nimport { SkeletonBox } from \"skullet/react\";\nimport { useConnection } from \"wagmi\";\nimport { Account, type AccountProps } from \"@/components/account\";\nimport {\n  ConnectWallet,\n  type ConnectWalletProps,\n} from \"@/components/connect-wallet\";\nimport { useMounted } from \"@/hooks/use-mounted\";\nimport { cn } from \"@/lib/utils\";\n\nexport type WalletButtonPhase = \"restoring\" | \"disconnected\" | \"connected\";\n\nexport type WalletButtonProps = {\n  /** Props for the \"Connect wallet\" button and picker. */\n  connect?: ConnectWalletProps;\n  /** Props for the connected-account button and panel. */\n  account?: AccountProps;\n  className?: string;\n};\n\n/** Which state the wallet button is in. \"restoring\" covers SSR and wagmi reconnecting on page load. */\nexport function useWalletButtonPhase(): WalletButtonPhase {\n  const mounted = useMounted();\n  const { status } = useConnection();\n  if (!mounted || status === \"reconnecting\") return \"restoring\";\n  return status === \"connected\" ? \"connected\" : \"disconnected\";\n}\n\n/**\n * The one wallet button most apps need: \"Connect wallet\" when disconnected,\n * the account button when connected, and a placeholder while a previous\n * connection is restored on page load, so it never flashes \"Connect wallet\"\n * at a returning user.\n */\nexport function WalletButton({\n  connect,\n  account,\n  className,\n}: WalletButtonProps) {\n  const phase = useWalletButtonPhase();\n\n  if (phase === \"restoring\") {\n    return (\n      <span\n        data-slot=\"wallet-button\"\n        data-phase={phase}\n        // The size of the default \"Connect wallet\" button.\n        className={cn(\"inline-flex h-10 w-[8.3rem]\", className)}\n      >\n        <SkeletonBox width=\"100%\" height=\"100%\" radius=\"9999px\" />\n        <span className=\"sr-only\">Restoring wallet connection</span>\n      </span>\n    );\n  }\n\n  if (phase === \"connected\") {\n    return (\n      <Account\n        {...account}\n        className={cn(className, account?.className)}\n      />\n    );\n  }\n\n  return (\n    <ConnectWallet\n      {...connect}\n      className={cn(\"h-10 rounded-full px-4\", className, connect?.className)}\n    />\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "docs": "Docs: https://0xui.io/components/wallet-button.md",
  "categories": [
    "wallet"
  ],
  "type": "registry:component"
}