Skip to content
wyllet
  • Docs
  • Features
  • Playground
  • Blog
  • Docs
  • Features
  • Playground
  • Blog
  • Compare
  • Changelog
GitHub @wylletdevnpm Support
esc
  • IntroductionWhat Wyllet is, what it includes, and how it fits into a wagmi + viem dApp.
  • InstallationInstall Wyllet and its peer dependencies, and enable WalletConnect.
  • Quick startAdd a working connect button to a React dApp in a few minutes.
  • Next.jsUse Wyllet with the Next.js App Router, server components and SSR.
  • Build with AI assistantsGive Cursor, Claude Code, Copilot or ChatGPT the Wyllet docs and the rules for a correct integration.
  • ConfigurationCreate a wagmi config with getDefaultConfig: app info, chains, transports and wallets.
  • WylletProviderEvery WylletProvider prop: theme, appearance, tokens, auth, messages and callbacks.
  • WylletButtonThe Island button, its display options, and building your own trigger with useWylletButton.
Overview

Getting started

  • Introduction
  • Installation
  • Quick start
  • Next.js
  • Build with AI assistants

Core concepts

  • Configuration
  • WylletProvider
  • WylletButton
  • Presentations

Customization

  • Theming
  • Class names
  • Translations

Wallets

  • Wallets
  • All wallets
  • WalletConnect

Chains and tokens

  • Chains
  • Tokens

Features

  • Account panel
  • Activity and transactions
  • Toasts
  • Sign-In With Ethereum
  • ConnectGate

Reference

  • Hooks
  • Components
  • Utilities and types

Guides

  • Security
  • Migrate from RainbowKit
  • FAQ
wyllet

The open-source wallet connector for React dApps. Built on wagmi and viem.

MIT licensed. v1.1.0 on npm with provenance.

Product

  • Features
  • Compare
  • Playground
  • Changelog
  • Blog

Docs

  • Quick start
  • Next.js
  • Build with AI
  • Theming
  • Migrate from RainbowKit

Community

  • GitHub
  • X @wylletdev
  • npm
  • Releases
  • Report an issue

Support

  • support@wyllet.dev
  • FAQ
  • Security
  • Report a vulnerability
  • MIT License

For AI agents

  • llms.txt
  • llms-full.txt
  • RSS feed
  • Sitemap

Wallet, network and token names and logos are trademarks of their respective owners and are used only to identify them.

Docs/Core concepts

WylletButton

The Island button, its display options, and building your own trigger with useWylletButton.

View .mdReport a problem

<WylletButton> is the Wallet Island: one button that changes with the connection state. When disconnected it is a call to action; when connected it shows the account's avatar, name, network and balance, and opens the account panel.

Usage

import { WylletButton } from 'wyllet'
 
<WylletButton />
<WylletButton size="lg" display="compact" label="Enter app" />

Props

PropTypeDefaultDescription
labelstringmessages.connect ("Connect")Text shown while disconnected.
size'sm' | 'md' | 'lg''md'Button height and text size.
display'full' | 'compact' | 'avatar''full'What the connected button shows. full: avatar, name and balance. compact: avatar and name. avatar: avatar only.
classNamestringNoneExtra class names, added after classNames.island.

States

The button renders differently depending on the connection.

StateWhat it showsOn click
Before mountA hidden, disabled placeholder that keeps the button's space.Nothing.
DisconnectedWallet icon, the label, and the shortcut hint if shortcut is set on the provider.Opens the connect view.
Connecting or reconnectingA spinner and "Connecting".Opens the connect view.
ConnectedAvatar with a network badge, the ENS name or shortened address, the native balance (with display="full") and a status dot.Opens the account view.
Wrong networkAn alert badge on the avatar and "Wrong network" in place of the name. No balance.Opens the account view on the Networks tab.
Needs sign-in"Verify" in place of the name and a pending status dot. No balance. Only with an auth adapter.Opens the connect view at the sign-in step.

"Wrong network" means the wallet is on a chain that is not in your wagmi config. The labels come from messages (connect, connecting, wrongNetwork and verify), so you can rename them. See Translations.

The button passes itself as the anchor when it opens the panel, so the popover presentation positions the panel next to it. See Presentations.

If the button ever throws while rendering, Wyllet falls back to a plain connect button so users can still open the panel.

Headless: useWylletButton

useWylletButton() returns the same state that powers <WylletButton>, so you can build your own trigger with full control over markup and styles.

import { useWylletButton } from 'wyllet'
 
export function ConnectButton() {
  const { mounted, account, chain, authStatus, open } = useWylletButton()
 
  if (!mounted) return null
 
  if (!account) {
    return <button onClick={(e) => open(e.currentTarget)}>Connect wallet</button>
  }
 
  return (
    <button onClick={(e) => open(e.currentTarget)}>
      {chain?.unsupported ? 'Wrong network' : authStatus === 'unauthenticated' ? 'Verify' : account.displayName}
      {account.balance && ` · ${account.balance.formatted} ${account.balance.symbol}`}
    </button>
  )
}

Return value

FieldTypeDescription
mountedbooleanfalse during server rendering and the first client render. Render a placeholder until it is true to avoid hydration mismatches.
status'disconnected' | 'connecting' | 'reconnecting' | 'connected'wagmi's connection status.
accountobject | undefinedSet only when connected. See below.
chainobject | undefinedSet only when connected. See below.
authStatus'loading' | 'unauthenticated' | 'authenticated' | undefinedSign-in status for the connected account. undefined when no auth adapter is configured.
open(anchor?: Element | null) => voidOpens the connect view when disconnected or not signed in, otherwise the account view.
openConnect(anchor?: Element | null) => voidOpens the connect view.
openAccount(anchor?: Element | null, tab?: AccountTab) => voidOpens the account view, optionally on a tab: 'tokens', 'activity' or 'networks'.

account contains:

FieldTypeDescription
addressAddressThe connected address.
displayNamestringThe ENS name if there is one, otherwise the shortened address.
ensNamestring | null | undefinedThe ENS name, when ENS is enabled and resolved.
balanceobject | undefinedNative balance: formatted (string), symbol, value (bigint) and decimals.

chain contains:

FieldTypeDescription
idnumberThe connected chain id.
namestringThe chain name, or "Chain" followed by the id when the chain is not in your config.
unsupportedbooleantrue when the chain is not in your wagmi config.
Note

The open functions here take the anchor element directly, as in open(e.currentTarget). The functions returned by useWyllet() take an options object instead, as in openConnect({ anchor: e.currentTarget }). See Hooks.

Styling

The button uses the islandBackground, islandText and shadows.island theme tokens while connected, and the accent color while disconnected. Change them through your theme, or add classes with className or classNames.island. See Theming and Class names.

Related

  • Presentations
  • ConnectGate
  • Hooks
PreviousWylletProviderNextPresentations

On this page

  • Usage
  • Props
  • States
  • Headless: useWylletButton
  • Return value
  • Styling
  • Related