Svelte#
AppKit has support for Wagmi and Ethers v6 on Ethereum, @solana/web3.js on Solana, Bitcoin, TON and TRON. Choose one of these to get started.
We recommend using SvelteKit v5 to get started with AppKit Svelte.
Installation#
Try installing AppKit Skills to get AI-assisted guidance. Your AI coding assistant can help you set up, build, and debug your AppKit integration.
To install AppKit Skills, run the following command in your terminal:
After installation, you can ask your AI assistant for help with AppKit setup, implementation, and troubleshooting.
AppKit is only compatible with wagmi 2.x. Ensure you are using a compatible version.
Cloud Configuration#
Create a new project on Reown Dashboard and obtain a new project ID.
Head over to Reown Dashboard and create a new project.
Implementation#
Check the Svelte Wagmi example
For this example, we'll be using Wagmi and Viem.
Start by importing 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.
Then import this configuration in your app layout to ensure AppKit is initialized:
Check the Svelte Ethers example
For this example, we'll be using Ethers.
Start by importing createAppKit from @reown/appkit and the necessary chains and EthersAdapter from @reown/appkit-adapter-ethers.
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.
MetaMask does not currently support WalletConnect connections on Solana. The MetaMask team is working on adding this feature. In the meantime, we recommend using other wallets that support Solana. You can find the complete list of supported wallets on WalletGuide.
For this example, we'll be using Solana.
Start by importing createAppKit from @reown/appkit and the necessary chains and SolanaAdapter from @reown/appkit-adapter-solana.
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.
For this example, we'll be using Bitcoin.
Start by importing createAppKit from @reown/appkit and the necessary chains and BitcoinAdapter from @reown/appkit-adapter-bitcoin.
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.
For this example, we'll be using TON.
Start by importing createAppKit from @reown/appkit and the necessary chains and TonAdapter from @reown/appkit-adapter-ton.
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.
For this example, we'll be using TRON.
Start by importing createAppKit from @reown/appkit and the necessary chains and TronAdapter from @reown/appkit-adapter-tron.
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.
Install Wallet Adapters#
TRON adapter requires you to install wallet adapters separately. This gives you control over which wallets to support and reduces bundle size.
For a complete list of available TRON wallet adapters, visit the official wallet adapter documentation.
Using Multiple Wallet Adapters#
After installing your desired wallet adapters, import and add them to the walletAdapters array when creating the TRON adapter:
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:
The <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:
Or use other AppKit web components:
The recommended way to trigger the modal is using the initializeAppKit function and web components:
You can also trigger the modal programmatically by calling the open method from AppKit instance:
You can select the modal's view when calling the open function:
You can trigger the modal by calling the open method from AppKit instance.
You can also select the modal's view when calling the open function.
You can trigger the modal by calling the open method from AppKit instance.
You can also select the modal's view when calling the open function.
You can trigger the modal by calling the open method from AppKit instance.
You can also select the modal's view when calling the open function.
To open AppKit you can use our web component or build your own button with AppKit actions.
In this example we are going to use the <appkit-button> component.
Web components are global html elements that don't require importing.
To open AppKit you can use our web component or build your own button with AppKit actions.
In this example we are going to use the <appkit-button> component.
Web components are global html elements that don't require importing.
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 wagmiConfig from our AppKit WagmiAdapter configuration.
Read more about Wagmi actions for smart contract interaction here.
Ethers can help us interact with wallets and smart contracts:
AppKit Skills#
AppKit Skills provide AI-powered assistance for building with Reown AppKit. Once installed, your AI coding assistant can help you set up, build, and debug your AppKit integration.
To install AppKit Skills, run the following command in your terminal:
After installation, you can ask your AI assistant for help with AppKit setup, implementation, and troubleshooting.