# useSwap

> @web3auth/modal Vue Composables useSwap | Embedded Wallets

Hook to open the swap interface using the Wallet Services plugin.

:::info

Please note that this composable doesn't work for external wallet logins. It only works for social login embedded wallets.

:::

### Import

```ts

```

### Usage

```html
<script setup lang="ts">

  const { showSwap, loading, error } = useSwap()
</script>

<template>
  <button @click="showSwap()" :disabled="loading">
    {{ loading ? "Opening Swap..." : "Open Swap" }}
  </button>
  Error: {{ error.message }}
</template>
```

### Return type

```ts

```

#### `loading`

`boolean`

Whether the swap interface is being opened.

#### `error`

`Web3AuthError | null`

Error that occurred while opening the swap interface.

#### `showSwap`

`(showSwapParams?: BaseEmbedControllerState["showSwap"]) => Promise<void>`

Function to open the swap interface. Accepts optional parameters for customizing the swap view.
