Skip to content

Commit 2685ee1

Browse files
Add alternative programmatic ways to trigger modal
- Show appKit.open() method with different view options - Include examples for Connect, Account, and general modal opening - Add other AppKit web components (connect-button, account-button, network-button) - Keep <appkit-button /> as main recommended approach with alternatives clearly labeled Co-Authored-By: rohit@reown.com <rrohitramesh710@gmail.com>
1 parent 654c0f3 commit 2685ee1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

appkit/svelte/core/installation.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,38 @@ The `<appkit-button />` is a web component that's automatically registered when
182182

183183
### Alternative approaches
184184

185+
You can also trigger the modal programmatically using the AppKit instance:
186+
187+
```svelte
188+
<script lang="ts">
189+
import { appKit } from '$lib/appkit';
190+
191+
function openModal() {
192+
appKit?.open();
193+
}
194+
195+
function openConnectModal() {
196+
appKit?.open({ view: 'Connect' });
197+
}
198+
199+
function openAccountModal() {
200+
appKit?.open({ view: 'Account' });
201+
}
202+
</script>
203+
204+
<button on:click={openModal}>Open Modal</button>
205+
<button on:click={openConnectModal}>Connect Wallet</button>
206+
<button on:click={openAccountModal}>View Account</button>
207+
```
208+
209+
Or use other AppKit web components:
210+
211+
```svelte
212+
<appkit-connect-button />
213+
<appkit-account-button />
214+
<appkit-network-button />
215+
```
216+
185217
<Tabs>
186218
<Tab title="Wagmi">
187219

0 commit comments

Comments
 (0)