Svelte
AppKit has support for Wagmi and Ethers v6 on Ethereum, @solana/web3.js on Solana and Bitcoin. Choose one of these to get started.We recommend using SvelteKit v5 to get started with AppKit Svelte.
Installation
Cloud Configuration
Create a new project on Reown Dashboard at https://dashboard.reown.com and obtain a new project ID.Implementation
Svelte Wagmi Example
Check the Svelte Wagmi example
createAppKit
from @reown/appkit
and the necessary chains and WagmiAdapter from @reown/appkit-adapter-wagmi
.Make sure to set your
VITE_PROJECT_ID
environment variable which you can get from Reown Dashboard.The
browser
check ensures AppKit is only initialized in the browser environment, which is important for SvelteKit’s SSR compatibility.Trigger the modal
The recommended way to trigger the modal in Svelte is to use the<appkit-button />
web component. After setting up AppKit in your application, you can simply use the button component anywhere in your Svelte templates:
<appkit-button />
is a web component that’s automatically registered when AppKit is initialized. No additional imports are required.
Alternative approaches
You can also trigger the modal programmatically using the AppKit instance:The recommended way to trigger the modal is using the You can also trigger the modal programmatically by calling the You can select the modal’s view when calling the
initializeAppKit
function and web components:open
method from AppKit instance:open
function:Blockchain Interaction
You need to install @wagmi/core to interact with smart contracts:Wagmi actions can help us interact with wallets and smart contracts:For this use case, we need to import the Read more about Wagmi actions for smart contract interaction here.
wagmiConfig
from our AppKit WagmiAdapter configuration.