Requirements
- React 19 or later
- wagmi
^2.19.5and viem^2.46.3, which are peer dependencies @tanstack/react-query, which wagmi needs
onConnectWallet.
Install the package
- npm
- pnpm
- Yarn
Set up providers
Add every chain you use to the wagmi config. ENSv2 flows needmainnet, and sepolia if you use isTestnet. Minting under an old Namespace listing can also need Base or Optimism.
providers.tsx
http() with no URL uses the chain’s public RPC, which is rate limited. Pass your own RPC URL in production.
Import the styles
Import the stylesheet once, at the root of your app. Without it the forms render unstyled.@thenamespace/ens-components/styles imports the same CSS from a JavaScript module, if your bundler prefers that.
The stylesheet loads DM Sans and DM Mono from Google Fonts. To change fonts, colors, or corners, see Theming.
Render a form
Wrap your app inProviders, then render a form. This example also wires the connect button:
app/register/page.tsx
onConnectWallet: Pass it to the registration, renewal, and subname forms. Without it, a disconnected user has no way to connect from inside the form.avatarUploadDomain: The bare hostname your app is served from, such asapp.example.com, with no protocol or path. It’s the domain in the sign-in message the user signs to upload an avatar or header image. When you leave it out, the form useswindow.location.hostname.
Use Next.js and other SSR frameworks
The forms use wallet hooks and browser APIs such aswindow and localStorage. Render them only in client components ('use client'), and keep the providers in a client component too, as in the example above.
Use testnet
SetisTestnet to use Sepolia instead of Ethereum mainnet. ENSv2 registration, renewal, subname minting, and subname renewal all work on Sepolia.
mode: 'sepolia'. See Offchain subnames.
Next steps
- Pick a form from the component overview.
- Restyle the forms with Theming.

