Skip to main content
Reown Docs

Composables

2 min read

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

Note

When using AppKit composables in Nuxt, make sure to use them within <client-only> components for SSR compatibility.

useAppKit#

Composable function for controlling the modal.

Returns#

  • open: Function to open the modal
  • close: Function to close the modal

Parameters#

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

List of views you can select

<Table> — not implemented in this renderer

useAppKitAccount#

Composable function for accessing account data and connection status.

Composable function for accessing account data and connection status for each namespace when working in a multi-chain environment.

Returns#

  • accountData.value.address: The current account address
  • accountData.value.caipAddress: The current account address in CAIP format
  • accountData.value.isConnected: Boolean that indicates if the user is connected
  • accountData.value.status: The current connection status

useAppKitNetwork#

Composable function for accessing network data and methods.

Returns#

  • networkData.caipNetwork: The current network object
  • networkData.caipNetworkId: The current network id in CAIP format
  • networkData.chainId: The current chain id
  • networkData.switchNetwork: Function to switch the network. Accepts a caipNetwork object as argument.

switchNetwork Usage#

Note

See how to import or create a networks here.

useAppKitState#

Composable function for getting the current value of the modal's state.

Returns#

  • stateData.open: Boolean that indicates if the modal is open
  • stateData.selectedNetworkId: The current chain id selected by the user

useAppKitTheme#

Composable function for controlling the modal's theme.

Returns#

  • themeAction.themeMode: Get theme Mode.
  • themeAction.themeVariables: Get theme variables.
  • themeAction.setThemeMode: Set theme Mode. Accepts a string as parameter ('dark' | 'light')
  • themeAction.setThemeVariables: Set theme variables. Check the example usage.

Example Usage#

useAppKitEvents#

Subscribes to modal, wallet, and transaction events emitted by AppKit. Useful for analytics, telemetry, custom notifications, or reacting to specific user actions.

The composable returns the latest event object. Each time a new event is emitted, the component re-renders with the new value:

Returns#

  • events.timestamp: Get the timestamp of the event
  • events.data.event: Get the event name string
  • events.data.properties: Get event-specific payload
Full events reference

See every available event, its trigger condition, and the properties payload.

useDisconnect#

Composable function for disconnecting the session.

Parameters#

  • namespace (optional): The specific chain namespace to disconnect from. If not provided, disconnects from all connected namespaces.

Use Cases#

  • Implementing a "Disconnect Wallet" button
  • Handling logout flows in your application
  • Cleaning up resources when a user disconnects
  • Resetting application state after disconnection
  • Disconnecting from specific chains in multi-chain applications

useWalletInfo#

Composable function for accessing wallet information.

Ethereum/Solana 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.

signMessage#

Action for signing messages with connected account.

useAppKitProvider#

Hook that returns the walletProvider and the WalletProviderType.

Learn More