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/Features

ConnectGate

Render content only when users are connected, on a supported network and signed in.

View .mdReport a problem

ConnectGate renders its children only when the user is ready: connected, on a supported network, and signed in when you use SIWE. Otherwise it shows a prompt with a button that opens the right step of the panel.

import { ConnectGate } from 'wyllet'
 
export function VaultPage() {
  return (
    <ConnectGate description="Connect a wallet to open the vault.">
      <Vault />
    </ConnectGate>
  )
}

It must be rendered inside WylletProvider.

Props

PropTypeDefaultDescription
childrenReactNodeContent shown when every requirement is met
requireSupportedChainbooleantrueAlso require a chain that is in your config
requireAuthbooleantrueAlso require a SIWE session. Only applies when an auth adapter is set
fallbackReactNode | ((reason: GateReason) => ReactNode)Replaces the default prompt
titleReactNode"Connect to continue"Title of the default prompt when disconnected
descriptionReactNode"This area needs a connected wallet."Body of the default prompt when disconnected
classNamestringExtra class name on the default prompt

title and description only change the disconnected prompt. The wrong-network and sign-in prompts use their own text from the messages object.

Reasons

The gate checks requirements in order and stops at the first one that fails. The result is a GateReason:

ReasonWhenDefault prompt button
'disconnected'No wallet is connectedConnect opens the connect panel
'wrongNetwork'Connected to a chain that is not in your config, and requireSupportedChain is trueNetworks opens the account panel on the Networks tab
'unauthenticated'An auth adapter is set, requireAuth is true, and the connected account has no sessionVerify opens the sign-in step

The prompt's button anchors the panel to itself, so the popover presentation opens next to it.

While the adapter's getSession() is still resolving, the gate treats the user as not signed in and shows the sign-in prompt.

Custom fallback

Pass a node to show the same fallback for every reason:

<ConnectGate fallback={<p>Connect your wallet to see your positions.</p>}>
  <Positions />
</ConnectGate>

Or pass a function to handle each reason yourself:

import { ConnectGate, useWyllet, type GateReason } from 'wyllet'
 
function Prompt({ reason }: { reason: GateReason }) {
  const { openConnect, openTab } = useWyllet()
  if (reason === 'wrongNetwork') return <button onClick={() => openTab('networks')}>Switch network</button>
  if (reason === 'unauthenticated') return <button onClick={() => openConnect()}>Sign in</button>
  return <button onClick={() => openConnect()}>Connect wallet</button>
}
 
<ConnectGate fallback={(reason) => <Prompt reason={reason} />}>
  <Dashboard />
</ConnectGate>

Opening the connect panel while connected but not signed in goes straight to the sign-in step.

Loosening requirements

// Connected is enough, on any chain, signed in or not.
<ConnectGate requireSupportedChain={false} requireAuth={false}>
  <Profile />
</ConnectGate>

Server rendering

The wallet connection only exists in the browser, so ConnectGate never renders its children on the server or during the first client render. Until it mounts:

  • With a fallback, it renders the fallback.
  • Without one, it renders the default prompt with visibility: hidden, so the space is reserved and nothing flashes.

After mounting, it renders the children or the prompt for the current state. This keeps server and client markup the same and avoids hydration errors in Next.js.

Note

ConnectGate hides UI. It does not protect data. Check the session on your server before returning anything private.

PreviousSign-In With EthereumNextHooks

On this page

  • Props
  • Reasons
  • Custom fallback
  • Loosening requirements
  • Server rendering