> For the complete documentation index, see [llms.txt](https://docs.tokentable.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tokentable.xyz/for-developers/airdrop/ton/integration.md).

# Integration

Integrating **ton-connect** enhances user interactions with the TON blockchain in your DApp. Below are the steps for integrating **ton-connect** using **React**, **Vue**, and **HTML/JavaScript (Vanilla)**.

### **Frontend Integration with ton-connect**

#### **1. React Integration**

#### Installation

To integrate **TON Connect** into your React application, install the **@tonconnect/ui-react** package:

```bash
npm install @tonconnect/ui-react
```

#### TON Connect Initiation

Wrap your application with `TonConnectUIProvider`, passing the manifest URL:

```jsx
import { TonConnectUIProvider } from '@tonconnect/ui-react';

export function App() {
    return (
        <TonConnectUIProvider manifestUrl="https://<YOUR_APP_URL>/tonconnect-manifest.json">
            { /* Your app */ }
        </TonConnectUIProvider>
    );
}
```

#### Connect to the Wallet

Add the `TonConnectButton` to allow users to connect their wallets:

```jsx
import { TonConnectButton } from '@tonconnect/ui-react';

export const Header = () => {
    return (
        <header>
            <span>My App with React UI</span>
            <TonConnectButton />
        </header>
    );
};
```

#### **2. Vue Integration**

#### Installation

To start integrating **TON Connect** into your Vue application, install the **@townsquarelabs/ui-vue** package:

```bash
npm install @townsquarelabs/ui-vue
```

#### TON Connect Initiation

Wrap your application with `TonConnectUIProvider`, specifying the manifest URL in the options:

```html
<template>
  <TonConnectUIProvider :options="options">
    <!-- Your app -->
  </TonConnectUIProvider>
</template>

<script>
import { TonConnectUIProvider } from '@townsquarelabs/ui-vue';

export default {
  components: { TonConnectUIProvider },
  setup() {
    const options = {
      manifestUrl: "https://<YOUR_APP_URL>/tonconnect-manifest.json",
    };
    return { options };
  }
}
</script>
```

#### Connect to the Wallet

Use the `TonConnectButton` to enable wallet connections:

```html
<template>
  <header>
    <span>My App with Vue UI</span>
    <TonConnectButton />
  </header>
</template>

<script>
import { TonConnectButton } from '@townsquarelabs/ui-vue';

export default {
  components: { TonConnectButton }
}
</script>
```

#### **3. HTML/JavaScript (Vanilla) Integration**

#### Installation

To integrate **TON Connect** into your HTML/JavaScript application, add the script in the `<head>` of your HTML:

```html
<script src="<https://unpkg.com/@tonconnect/ui@latest/dist/tonconnect-ui.min.js>"></script>
```

#### TON Connect Initiation

Add a button in your HTML to connect to the wallet:

```html
<div id="ton-connect"></div>

<script>
    const tonConnectUI = new TON_CONNECT_UI.TonConnectUI({
        manifestUrl: 'https://<YOUR_APP_URL>/tonconnect-manifest.json',
        buttonRootId: 'ton-connect'
    });
</script>
```

#### Connect to the Wallet

The "Connect" button will automatically handle clicks. You can also open the connect modal programmatically:

```html
<script>
    async function connectToWallet() {
        const connectedWallet = await tonConnectUI.connectWallet();
        console.log(connectedWallet); // Handle the connected wallet as needed
    }

    // Call the function to connect
    connectToWallet().catch(error => {
        console.error("Error connecting to wallet:", error);
    });
</script>
```

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tokentable.xyz/for-developers/airdrop/ton/integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
