@mysten/dapp-kit-react 1.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/index.d.mts +22 -40
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +2 -55
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/ui.d.mts +23 -0
  6. package/dist/ui.d.mts.map +1 -0
  7. package/dist/ui.mjs +38 -0
  8. package/dist/ui.mjs.map +1 -0
  9. package/dist/useDAppKit-LUp-KcgG.mjs +24 -0
  10. package/dist/useDAppKit-LUp-KcgG.mjs.map +1 -0
  11. package/docs/actions/connect-wallet.md +68 -0
  12. package/docs/actions/disconnect-wallet.md +37 -0
  13. package/docs/actions/sign-and-execute-transaction.md +95 -0
  14. package/docs/actions/sign-personal-message.md +57 -0
  15. package/docs/actions/sign-transaction.md +64 -0
  16. package/docs/actions/switch-account.md +36 -0
  17. package/docs/actions/switch-network.md +36 -0
  18. package/docs/dapp-kit-instance.md +163 -0
  19. package/docs/getting-started/create-dapp.md +151 -0
  20. package/docs/getting-started/next-js.md +162 -0
  21. package/docs/getting-started/react.md +170 -0
  22. package/docs/getting-started/vue.md +188 -0
  23. package/docs/index.md +70 -0
  24. package/docs/llms-index.md +34 -0
  25. package/docs/react/components/connect-button.md +42 -0
  26. package/docs/react/components/connect-modal.md +51 -0
  27. package/docs/react/components/index.md +13 -0
  28. package/docs/react/dapp-kit-provider.md +86 -0
  29. package/docs/react/hooks/index.md +25 -0
  30. package/docs/react/hooks/use-current-account.md +33 -0
  31. package/docs/react/hooks/use-current-client.md +36 -0
  32. package/docs/react/hooks/use-current-network.md +28 -0
  33. package/docs/react/hooks/use-current-wallet.md +36 -0
  34. package/docs/react/hooks/use-dapp-kit.md +100 -0
  35. package/docs/react/hooks/use-wallet-connection.md +48 -0
  36. package/docs/react/hooks/use-wallets.md +33 -0
  37. package/docs/state.md +168 -0
  38. package/docs/theming.md +196 -0
  39. package/docs/web-components/connect-button.md +87 -0
  40. package/docs/web-components/connect-modal.md +176 -0
  41. package/package.json +9 -2
  42. package/src/index.ts +0 -6
  43. package/src/ui.ts +8 -0
@@ -0,0 +1,33 @@
1
+ # useCurrentAccount
2
+
3
+ > React hook to get the current wallet account
4
+
5
+ The `useCurrentAccount` hook provides access to the currently selected account.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const account = useCurrentAccount();
15
+
16
+ if (!account) {
17
+ return <div>No account selected</div>;
18
+ }
19
+
20
+ return (
21
+ <div>
22
+ <p>Address: {account.address}</p>
23
+ <p>Label: {account.label}</p>
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Return Value
30
+
31
+ ```tsx
32
+ UiWalletAccount | null;
33
+ ```
@@ -0,0 +1,36 @@
1
+ # useCurrentClient
2
+
3
+ > React hook to get the current Sui client instance
4
+
5
+ The `useCurrentClient` hook provides access to the blockchain client instance for the current
6
+ network.
7
+
8
+ > **Note:** By default, this returns a `SuiClient` instance when using the standard setup. However,
9
+ > the dApp Kit supports any client that implements the Sui core API, making it flexible for
10
+ > different blockchain implementations.
11
+
12
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
13
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+
19
+ const client = useCurrentClient();
20
+
21
+ const handleQuery = async () => {
22
+ const balance = await client.getBalance({
23
+ owner: '0x...',
24
+ });
25
+ console.log(balance);
26
+ };
27
+
28
+ return <button onClick={handleQuery}>Check Balance</button>;
29
+ }
30
+ ```
31
+
32
+ ## Return Value
33
+
34
+ ```tsx
35
+ SuiClient;
36
+ ```
@@ -0,0 +1,28 @@
1
+ # useCurrentNetwork
2
+
3
+ > React hook to get the current network
4
+
5
+ The `useCurrentNetwork` hook provides access to the currently selected network.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const network = useCurrentNetwork();
15
+
16
+ return (
17
+ <div>
18
+ <p>Current network: {network}</p>
19
+ </div>
20
+ );
21
+ }
22
+ ```
23
+
24
+ ## Return Value
25
+
26
+ ```tsx
27
+ string;
28
+ ```
@@ -0,0 +1,36 @@
1
+ # useCurrentWallet
2
+
3
+ > React hook to get the current wallet connection
4
+
5
+ The `useCurrentWallet` hook provides access to the currently connected wallet.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const wallet = useCurrentWallet();
15
+
16
+ if (!wallet) {
17
+ return <div>No wallet connected</div>;
18
+ }
19
+
20
+ return (
21
+ <div>
22
+ <p>Wallet: {wallet.name}</p>
23
+ <p>
24
+ Icon: <img src={wallet.icon} alt={wallet.name} />
25
+ </p>
26
+ <p>Accounts: {wallet.accounts.length}</p>
27
+ </div>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ## Return Value
33
+
34
+ ```tsx
35
+ UiWallet | null;
36
+ ```
@@ -0,0 +1,100 @@
1
+ # useDAppKit
2
+
3
+ > React hook to access the full dApp Kit instance
4
+
5
+ The `useDAppKit` hook provides direct access to the dApp Kit instance within React components,
6
+ enabling you to call actions and access the underlying functionality.
7
+
8
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
9
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+
15
+ const dAppKit = useDAppKit();
16
+
17
+ async function handleConnect() {
18
+ try {
19
+ await dAppKit.connectWallet({ wallet });
20
+ console.log('Connected successfully');
21
+ } catch (error) {
22
+ console.error('Connection failed:', error);
23
+ }
24
+ }
25
+
26
+ return <button onClick={handleConnect}>Connect Wallet</button>;
27
+ }
28
+ ```
29
+
30
+ ## Return Value
31
+
32
+ ```ts
33
+ {
34
+ // Actions
35
+ connectWallet: (args: { wallet: UiWallet; account?: UiWalletAccount }) => Promise<{ accounts: UiWalletAccount[]; }>;
36
+ disconnectWallet: () => Promise<void>;
37
+ switchAccount: (args: { account: UiWalletAccount }) => Promise<void>;
38
+ switchNetwork: (network: string) => void;
39
+ signTransaction: (args: { transaction: Transaction | string; signal?: AbortSignal }) => Promise<SignedTransaction>;
40
+ signAndExecuteTransaction: (args: { transaction: Transaction | string; signal?: AbortSignal }) => Promise<TransactionResult>;
41
+ signPersonalMessage: (args: { message: Uint8Array }) => Promise<SignedPersonalMessage>;
42
+
43
+ // Properties
44
+ networks: string[];
45
+ stores: {
46
+ $wallets: DAppKitStores['$compatibleWallets'];
47
+ $connection: DAppKitStores['$connection'];
48
+ $currentNetwork: ReadableAtom<TNetworks[number]>;
49
+ $currentClient: ReadableAtom<Client>;
50
+ };
51
+ getClient: (network?: string) => Client;
52
+ }
53
+ ```
54
+
55
+ ## Examples
56
+
57
+ ### Transaction Execution
58
+
59
+ ```tsx
60
+
61
+ const dAppKit = useDAppKit();
62
+
63
+ async function handleTransfer() {
64
+ const tx = new Transaction();
65
+ tx.transferObjects([tx.object('0x123...')], '0xrecipient...');
66
+
67
+ try {
68
+ const result = await dAppKit.signAndExecuteTransaction({
69
+ transaction: tx,
70
+ });
71
+
72
+ if (result.FailedTransaction) {
73
+ throw new Error(`Transaction failed: ${result.FailedTransaction.status.error?.message}`);
74
+ }
75
+
76
+ console.log('Transaction digest:', result.Transaction.digest);
77
+ } catch (error) {
78
+ console.error('Transaction failed:', error);
79
+ }
80
+ }
81
+
82
+ return <button onClick={handleTransfer}>Transfer</button>;
83
+ }
84
+ ```
85
+
86
+ ### Subscribing to State Changes
87
+
88
+ ```tsx
89
+
90
+ const dAppKit = useDAppKit();
91
+ useEffect(() => {
92
+ // Subscribe directly to connection store changes
93
+ const unsubscribe = dAppKit.stores.$connection.subscribe((connection) => {
94
+ console.log('Connection status:', connection.status);
95
+ });
96
+ return unsubscribe;
97
+ }, [dAppKit]);
98
+ return null;
99
+ }
100
+ ```
@@ -0,0 +1,48 @@
1
+ # useWalletConnection
2
+
3
+ > React hook to manage wallet connection and disconnection
4
+
5
+ The `useWalletConnection` hook provides access to the current wallet connection status and
6
+ information.
7
+
8
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
9
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+
15
+ const connection = useWalletConnection();
16
+
17
+ if (connection.status === 'disconnected') {
18
+ return <div>Please connect your wallet</div>;
19
+ }
20
+
21
+ if (connection.status === 'connecting') {
22
+ return <div>Connecting...</div>;
23
+ }
24
+
25
+ // status === 'connected'
26
+ return (
27
+ <div>
28
+ <p>Connected to: {connection.wallet.name}</p>
29
+ <p>Address: {connection.account.address}</p>
30
+ </div>
31
+ );
32
+ }
33
+ ```
34
+
35
+ ## Return Value
36
+
37
+ ```tsx
38
+ {
39
+ status: 'disconnected' | 'connecting' | 'reconnecting' | 'connected';
40
+ wallet: UiWallet | null;
41
+ account: UiWalletAccount | null;
42
+ supportedIntents: string[];
43
+ isConnected: boolean;
44
+ isConnecting: boolean;
45
+ isReconnecting: boolean;
46
+ isDisconnected: boolean;
47
+ }
48
+ ```
@@ -0,0 +1,33 @@
1
+ # useWallets
2
+
3
+ > React hook to list available wallets
4
+
5
+ The `useWallets` hook provides access to all available wallets.
6
+
7
+ > **Warning:** All dApp Kit hooks must be used within components that are descendants of
8
+ > [DAppKitProvider](../dapp-kit-provider). Using them outside will result in an error.
9
+
10
+ ## Usage
11
+
12
+ ```tsx
13
+
14
+ const wallets = useWallets();
15
+
16
+ return (
17
+ <div>
18
+ {wallets.map((wallet) => (
19
+ <div key={wallet.name}>
20
+ <img src={wallet.icon} alt={wallet.name} />
21
+ <span>{wallet.name}</span>
22
+ </div>
23
+ ))}
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Return Value
30
+
31
+ ```tsx
32
+ UiWallet[]
33
+ ```
package/docs/state.md ADDED
@@ -0,0 +1,168 @@
1
+ # State
2
+
3
+ > Access and subscribe to wallet connection state in dApp Kit
4
+
5
+ The Sui dApp Kit SDK uses [nanostores](https://github.com/nanostores/nanostores) for state
6
+ management, providing a lightweight, framework-agnostic solution that works across React, Vue,
7
+ Vanilla JavaScript, and other frameworks.
8
+
9
+ ## Available Stores
10
+
11
+ The dApp Kit exposes four reactive stores that you can subscribe to:
12
+
13
+ - **`$connection`** - Current wallet connection state
14
+ - **`$currentNetwork`** - Currently selected network
15
+ - **`$currentClient`** - Client instance for the current network
16
+ - **`$wallets`** - List of available wallets
17
+
18
+ ## Accessing Stores
19
+
20
+ All stores are available through the `dAppKit.stores` property:
21
+
22
+ ```typescript
23
+ const dAppKit = createDAppKit({
24
+ /* config */
25
+ });
26
+
27
+ // Access stores
28
+ const connection = dAppKit.stores.$connection.get();
29
+ const currentNetwork = dAppKit.stores.$currentNetwork.get();
30
+ const client = dAppKit.stores.$currentClient.get();
31
+ const wallets = dAppKit.stores.$wallets.get();
32
+ ```
33
+
34
+ ## Subscribing to State Changes
35
+
36
+ Subscribe to any store to react to state changes:
37
+
38
+ ```typescript
39
+ // Subscribe to connection changes
40
+ const unsubscribe = dAppKit.stores.$connection.subscribe((connection) => {
41
+ if (connection.isConnected && connection.wallet && connection.account) {
42
+ console.log('Connected to:', connection.wallet.name);
43
+ console.log('Account:', connection.account.address);
44
+ } else {
45
+ console.log('Not connected');
46
+ }
47
+ });
48
+
49
+ // Clean up subscription when done
50
+ unsubscribe();
51
+ ```
52
+
53
+ ## Store Details
54
+
55
+ ### Connection Store (`$connection`)
56
+
57
+ Contains the current wallet connection state with status flags:
58
+
59
+ ```typescript
60
+ const connection = dAppKit.stores.$connection.get();
61
+
62
+ // Connection has these properties:
63
+ // - wallet: UiWallet | null
64
+ // - account: UiWalletAccount | null
65
+ // - status: 'connected' | 'connecting' | 'reconnecting' | 'disconnected'
66
+ // - supportedIntents: string[]
67
+ // - isConnected: boolean
68
+ // - isConnecting: boolean
69
+ // - isReconnecting: boolean
70
+ // - isDisconnected: boolean
71
+ ```
72
+
73
+ Example usage:
74
+
75
+ ```typescript
76
+ const connection = dAppKit.stores.$connection.get();
77
+
78
+ if (connection.isConnected && connection.wallet && connection.account) {
79
+ console.log('Address:', connection.account.address);
80
+ console.log('Wallet:', connection.wallet.name);
81
+ console.log('Available accounts:', connection.wallet.accounts);
82
+ }
83
+ ```
84
+
85
+ ### Current Network Store (`$currentNetwork`)
86
+
87
+ Contains the currently selected network as a string:
88
+
89
+ ```typescript
90
+ const currentNetwork = dAppKit.stores.$currentNetwork.get(); // 'mainnet' | 'testnet' | ...
91
+
92
+ // Subscribe to network changes
93
+ dAppKit.stores.$currentNetwork.subscribe((network) => {
94
+ console.log('Switched to network:', network);
95
+ });
96
+ ```
97
+
98
+ Note: This store is read-only. Use `dAppKit.switchNetwork()` to change networks.
99
+
100
+ ### Current Client Store (`$currentClient`)
101
+
102
+ Contains the SuiClient instance for the current network:
103
+
104
+ ```typescript
105
+ const client = dAppKit.stores.$currentClient.get();
106
+
107
+ // Use the client to query the blockchain
108
+ const balance = await client.getBalance({
109
+ owner: '0x...',
110
+ });
111
+ ```
112
+
113
+ Note: This store automatically updates when the network changes.
114
+
115
+ ### Wallets Store (`$wallets`)
116
+
117
+ Contains the list of available wallets:
118
+
119
+ ```typescript
120
+ const wallets = dAppKit.stores.$wallets.get();
121
+
122
+ wallets.forEach((wallet) => {
123
+ console.log('Wallet:', wallet.name);
124
+ console.log('Icon:', wallet.icon);
125
+ });
126
+ ```
127
+
128
+ ## Subscribing to State Changes
129
+
130
+ You can subscribe directly to stores:
131
+
132
+ ```typescript
133
+ // Subscribe to connection changes
134
+ dAppKit.stores.$connection.subscribe((connection) => {
135
+ const statusElement = document.getElementById('connection-status');
136
+ if (statusElement === null) return;
137
+ if (connection.isConnected && connection.account) {
138
+ statusElement.textContent = `Connected: ${connection.account.address}`;
139
+ } else {
140
+ statusElement.textContent = 'Not connected';
141
+ }
142
+ });
143
+
144
+ // Subscribe to network changes
145
+ dAppKit.stores.$currentNetwork.subscribe((network) => {
146
+ const networkElement = document.getElementById('current-network');
147
+ if (networkElement === null) return;
148
+ networkElement.textContent = `Network: ${network}`;
149
+ });
150
+ ```
151
+
152
+ ## React
153
+
154
+ React users can use the [provided hooks](./react/hooks/use-wallet-connection) instead of direct
155
+ store access.
156
+
157
+ ## Properties
158
+
159
+ Besides stores, some values are available as direct properties:
160
+
161
+ ```typescript
162
+ // Get available networks (not a store, just a property)
163
+ const networks = dAppKit.networks; // ['mainnet', 'testnet', ...]
164
+
165
+ // Get client for specific network
166
+ const mainnetClient = dAppKit.getClient('mainnet');
167
+ const currentClient = dAppKit.getClient(); // Current network's client
168
+ ```
@@ -0,0 +1,196 @@
1
+ # Theming
2
+
3
+ > Customize the appearance of dApp Kit UI components
4
+
5
+ The dApp Kit web components use a theming system compatible with
6
+ [shadcn/ui](https://ui.shadcn.com/docs/theming). Components are customized using CSS custom
7
+ properties (CSS variables), allowing you to match them to your application's design system.
8
+
9
+ > **Note:** **shadcn/ui Compatibility**: The dApp Kit uses the same CSS custom property naming
10
+ > convention as shadcn/ui. If your application already uses shadcn/ui themes, the dApp Kit
11
+ > components will automatically inherit your theme. You can also use
12
+ > [shadcn/ui's theme builder](https://ui.shadcn.com/themes) to create custom themes.
13
+
14
+ ## CSS Custom Properties
15
+
16
+ All dApp Kit web components support the following CSS custom properties:
17
+
18
+ ### Colors
19
+
20
+ These color variables follow the shadcn/ui naming convention. Colors can be defined using any valid
21
+ CSS color format (hex, rgb, hsl, oklch, etc.).
22
+
23
+ - **`--background`** - Background color of the component. Used as the default background for UI
24
+ elements.
25
+ - **`--foreground`** - Foreground color of the component. Used as the default text color.
26
+ - **`--primary`** - Primary color used for interactive elements such as buttons and links.
27
+ - **`--primary-foreground`** - Text or icon color placed on top of primary elements.
28
+ - **`--secondary`** - Secondary color used for less prominent interactive elements.
29
+ - **`--secondary-foreground`** - Text or icon color placed on top of secondary elements.
30
+ - **`--border`** - Border color for UI elements.
31
+ - **`--accent`** - Accent color used for highlights and decorative elements.
32
+ - **`--accent-foreground`** - Text or icon color placed on top of accent elements.
33
+ - **`--muted`** - Background color for subtle or muted UI elements (e.g., placeholders, disabled
34
+ states).
35
+ - **`--muted-foreground`** - Text or icon color for muted UI elements.
36
+ - **`--popover`** - Background color for floating elements such as popovers, dropdowns, or tooltips.
37
+ - **`--popover-foreground`** - Text or icon color inside popover elements.
38
+ - **`--ring`** - Color used for focus rings (visible focus indicators on interactive elements).
39
+
40
+ ### Typography
41
+
42
+ - **`--font-sans`** - Font family used for text content.
43
+ - **`--font-weight-medium`** - Medium font weight for text (typically used for buttons and
44
+ interactive elements).
45
+ - **`--font-weight-semibold`** - Semibold font weight for text (typically used for headings or
46
+ emphasized text).
47
+
48
+ ### Layout
49
+
50
+ - **`--radius`** - Border radius used for UI elements.
51
+
52
+ ## Usage
53
+
54
+ ### Global Theming
55
+
56
+ Apply custom properties to affect all dApp Kit components:
57
+
58
+ ```css
59
+ :root {
60
+ --primary: #4f46e5;
61
+ --primary-foreground: #ffffff;
62
+ --background: #ffffff;
63
+ --foreground: #0f172a;
64
+ --border: #e2e8f0;
65
+ --radius: 0.5rem;
66
+ --font-sans: 'Inter', sans-serif;
67
+ }
68
+ ```
69
+
70
+ ### Component-Specific Theming
71
+
72
+ Target specific components:
73
+
74
+ ```css
75
+ mysten-dapp-kit-connect-button {
76
+ --primary: #10b981;
77
+ --primary-foreground: #ffffff;
78
+ --radius: 0.75rem;
79
+ }
80
+
81
+ mysten-dapp-kit-connect-modal {
82
+ --background: #f8fafc;
83
+ --popover: #ffffff;
84
+ }
85
+ ```
86
+
87
+ ### Dark Mode
88
+
89
+ Implement dark mode by overriding the custom properties:
90
+
91
+ ```css
92
+ :root {
93
+ --background: #ffffff;
94
+ --foreground: #0f172a;
95
+ --primary: #4f46e5;
96
+ --border: #e2e8f0;
97
+ }
98
+
99
+ @media (prefers-color-scheme: dark) {
100
+ :root {
101
+ --background: #0f172a;
102
+ --foreground: #f1f5f9;
103
+ --primary: #818cf8;
104
+ --border: #334155;
105
+ }
106
+ }
107
+ ```
108
+
109
+ Or use a class-based approach:
110
+
111
+ ```css
112
+ .light-theme {
113
+ --background: #ffffff;
114
+ --foreground: #0f172a;
115
+ }
116
+
117
+ .dark-theme {
118
+ --background: #0f172a;
119
+ --foreground: #f1f5f9;
120
+ }
121
+ ```
122
+
123
+ ```tsx
124
+ <div className={isDark ? 'dark-theme' : 'light-theme'}>
125
+ <ConnectButton />
126
+ </div>
127
+ ```
128
+
129
+ ## Example: Complete Theme
130
+
131
+ Here's a complete theme example matching a custom design system:
132
+
133
+ ```css
134
+ :root {
135
+ /* Colors */
136
+ --background: hsl(0 0% 100%);
137
+ --foreground: hsl(222.2 84% 4.9%);
138
+ --primary: hsl(221.2 83.2% 53.3%);
139
+ --primary-foreground: hsl(210 40% 98%);
140
+ --secondary: hsl(210 40% 96.1%);
141
+ --secondary-foreground: hsl(222.2 47.4% 11.2%);
142
+ --accent: hsl(210 40% 96.1%);
143
+ --accent-foreground: hsl(222.2 47.4% 11.2%);
144
+ --muted: hsl(210 40% 96.1%);
145
+ --muted-foreground: hsl(215.4 16.3% 46.9%);
146
+ --border: hsl(214.3 31.8% 91.4%);
147
+ --popover: hsl(0 0% 100%);
148
+ --popover-foreground: hsl(222.2 84% 4.9%);
149
+ --ring: hsl(221.2 83.2% 53.3%);
150
+
151
+ /* Typography */
152
+ --font-sans:
153
+ system-ui, -apple-system, 'Segoe UI', 'Roboto', 'Ubuntu', 'Cantarell', 'Noto Sans', sans-serif;
154
+ --font-weight-medium: 500;
155
+ --font-weight-semibold: 600;
156
+
157
+ /* Layout */
158
+ --radius: 0.5rem;
159
+ }
160
+ ```
161
+
162
+ ## Framework Integration
163
+
164
+ ### React
165
+
166
+ ```tsx
167
+
168
+ return <ConnectButton />;
169
+ }
170
+ ```
171
+
172
+ ### Vue
173
+
174
+ ```vue
175
+ <template>
176
+ <mysten-dapp-kit-connect-button :instance="dAppKit" />
177
+ </template>
178
+
179
+ <style>
180
+ @import './theme.css';
181
+ </style>
182
+ ```
183
+
184
+ ### Vanilla JavaScript
185
+
186
+ ```html
187
+ <!doctype html>
188
+ <html>
189
+ <head>
190
+ <link rel="stylesheet" href="theme.css" />
191
+ </head>
192
+ <body>
193
+ <mysten-dapp-kit-connect-button></mysten-dapp-kit-connect-button>
194
+ </body>
195
+ </html>
196
+ ```