Skip to main content

Composables

Composables are functions that will help you control the modal, subscribe to wallet events and interact with them and smart contracts.

useAppKit

Control the modal with the useAppKit function

import { useAppKit } from '@reown/appkit/vue'

export default function Component() {
const { open, close } = useAppKit()

open()

//...
}

You can also select the modal's view when calling the open function

open({ view: 'Account' })

List of views you can select

VariableDescription
ConnectPrincipal view of the modal - default view when disconnected
AccountUser profile - default view when connected
AllWalletsShows the list of all available wallets
NetworksList of available networks - you can select and target a specific network before connecting
WhatIsANetwork"What is a network" onboarding view
WhatIsAWallet"What is a wallet" onboarding view
OnRampProviders"On-Ramp main view

useDisconnect

// import useDisconnect from wagmi if on EVM
//import useDisconnect from @reown/appkit-solana/vue if on Solana
const { disconnect } = useDisconnect()

disconnect()

useWalletInfo

Metadata information from the connected wallet

import { useWalletInfo } from '@reown/appkit/vue'

export default Component(){
const { walletInfo } = useWalletInfo()

console.log(walletInfo.name, walletInfo.icon)

//...
}

Ethereum Library

You can use Wagmi actions to sign messages, interact with smart contracts, and much more.

getAccount

Action for accessing account data and connection status.

import { getAccount } from '@wagmi/core'

const account = getAccount()

signMessage

Action for signing messages with connected account.

import { signMessage } from '@wagmi/core'

const signature = await signMessage({
message: 'gm wagmi frens'
})

useAppKitState

Get the current value of the modal's state

import { useAppKitState } from '@reown/appkit/vue'

const { open, selectedNetworkId } = useAppKitState()

The modal state consists of two reactive values:

ValueDescriptionType
openOpen state will be true when the modal is open and false when closed.
boolean
selectedNetworkIdThe current chain id selected by the user
number

useAppKitTheme

import { useAppKitTheme } from '@reown/appkit/vue'
const { themeMode, themeVariables, setThemeMode, setThemeVariables } = useAppKitTheme()

setThemeMode('dark')

setThemeVariables({
'--w3m-color-mix': '#00BB7F',
'--w3m-color-mix-strength': 40
})

Track modal events

import { useAppKitEvents } from '@reown/appkit/vue'

const events = useAppKitEvents()