Skip to content

Commit b92a532

Browse files
Update React/Next.js Components documentation with new React components (#581)
- Replace HTML elements with React components in React/Next.js docs - Add proper import statements for AppKit React components - Update shared components snippet to include React examples - Update React Solana trigger modal to use AppKitButton component - Add component properties documentation for all React components - Maintain backward compatibility by keeping HTML element docs for other frameworks Based on AppKit PR #4687 that introduces React components using @lit/react Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
1 parent 9b61aeb commit b92a532

File tree

4 files changed

+121
-19
lines changed

4 files changed

+121
-19
lines changed

appkit/next/core/components.mdx

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
11
---
2-
title: Web Components
3-
sidebarTitle: Components
2+
title: Components
43
---
54

6-
import Components from "/snippets/appkit/shared/components.mdx";
5+
AppKit provides pre-built React components that you can use to trigger the modal or display wallet information in your Next.js application.
76

8-
<Components />
7+
## React Components
8+
9+
```tsx
10+
import {
11+
AppKitButton,
12+
AppKitConnectButton,
13+
AppKitAccountButton,
14+
AppKitNetworkButton
15+
} from "@reown/appkit/react";
16+
17+
export default function MyApp() {
18+
return (
19+
<div>
20+
{/* Default button that handles the modal state */}
21+
<AppKitButton />
22+
23+
{/* Button for connecting a wallet */}
24+
<AppKitConnectButton />
25+
26+
{/* Button for account view */}
27+
<AppKitAccountButton />
28+
29+
{/* Button for network selection */}
30+
<AppKitNetworkButton />
31+
</div>
32+
);
33+
}
34+
```
35+
36+
### Component Properties
37+
38+
All React components support the same properties as their HTML element counterparts:
39+
40+
- **AppKitButton**: `size`, `label`, `loadingLabel`, `disabled`, `balance`, `namespace`
41+
- **AppKitConnectButton**: `size`, `label`, `loadingLabel`
42+
- **AppKitAccountButton**: `disabled`, `balance`
43+
- **AppKitNetworkButton**: `disabled`
944

1045
### `<appkit-wallet-button />`
1146

@@ -49,7 +84,11 @@ import "@reown/appkit-wallet-button/react";
4984
3. use the component in your project:
5085

5186
```tsx
52-
<appkit-wallet-button wallet="metamask" />
87+
import { AppKitWalletButton } from "@reown/appkit-wallet-button/react";
88+
89+
export default function MyApp() {
90+
return <AppKitWalletButton wallet="metamask" />;
91+
}
5392
```
5493

5594
#### Multichain Support

appkit/react/core/components.mdx

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
11
---
2-
title: Web Components
3-
sidebarTitle: Components
2+
title: Components
43
---
54

6-
import Components from "/snippets/appkit/shared/components.mdx";
5+
AppKit provides pre-built React components that you can use to trigger the modal or display wallet information.
76

8-
## Trigger the modal
7+
## React Components
98

10-
<Components />
9+
```tsx
10+
import {
11+
AppKitButton,
12+
AppKitConnectButton,
13+
AppKitAccountButton,
14+
AppKitNetworkButton
15+
} from "@reown/appkit/react";
16+
17+
export default function MyApp() {
18+
return (
19+
<div>
20+
{/* Default button that handles the modal state */}
21+
<AppKitButton />
22+
23+
{/* Button for connecting a wallet */}
24+
<AppKitConnectButton />
25+
26+
{/* Button for account view */}
27+
<AppKitAccountButton />
28+
29+
{/* Button for network selection */}
30+
<AppKitNetworkButton />
31+
</div>
32+
);
33+
}
34+
```
35+
36+
### Component Properties
37+
38+
All React components support the same properties as their HTML element counterparts:
39+
40+
- **AppKitButton**: `size`, `label`, `loadingLabel`, `disabled`, `balance`, `namespace`
41+
- **AppKitConnectButton**: `size`, `label`, `loadingLabel`
42+
- **AppKitAccountButton**: `disabled`, `balance`
43+
- **AppKitNetworkButton**: `disabled`
1144

1245
## React Components
1346

@@ -85,7 +118,11 @@ import "@reown/appkit-wallet-button/react";
85118
3. Use the component in the project:
86119

87120
```tsx
88-
<appkit-wallet-button wallet="metamask" />
121+
import { AppKitWalletButton } from "@reown/appkit-wallet-button/react";
122+
123+
export default function MyApp() {
124+
return <AppKitWalletButton wallet="metamask" />;
125+
}
89126
```
90127

91128
#### Multichain Support

appkit/react/solana/triggermodal.mdx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
To open AppKit you can use our [**web component**](../core/components) or build your own button with AppKit [**hooks**](../core/hooks.mdx#useAppKit).
1+
To open AppKit you can use our [**React components**](../core/components) or build your own button with AppKit [**hooks**](../core/hooks.mdx#useAppKit).
22

33
<Tabs>
4-
<Tab title="Web Component">
4+
<Tab title="React Component">
55

66
```tsx
7+
import { AppKitButton } from "@reown/appkit/react";
8+
79
export default function ConnectButton() {
8-
return <appkit-button />;
10+
return <AppKitButton />;
911
}
1012
```
1113

12-
Learn more about the AppKit web components [here](../core/components)
13-
14-
<Info>
15-
Web components are global html elements that don't require importing.
16-
</Info>
14+
Learn more about the AppKit React components [here](../core/components)
1715

1816
</Tab>
1917
<Tab title="Hooks">

snippets/appkit/shared/components.mdx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
AppKit provides pre-built UI components that you can use to trigger the modal or display wallet information.
2+
3+
## React Components
4+
5+
For React and Next.js applications, you can use React components instead of HTML elements:
6+
7+
```tsx
8+
import {
9+
AppKitButton,
10+
AppKitConnectButton,
11+
AppKitAccountButton,
12+
AppKitNetworkButton
13+
} from "@reown/appkit/react";
14+
15+
export default function MyApp() {
16+
return (
17+
<div>
18+
<AppKitButton />
19+
<AppKitConnectButton />
20+
<AppKitAccountButton />
21+
<AppKitNetworkButton />
22+
</div>
23+
);
24+
}
25+
```
26+
27+
## HTML Elements
28+
129
AppKit's [web components](https://www.webcomponents.org/) are custom and reusable HTML tags. They will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML.
230

331
<Note>

0 commit comments

Comments
 (0)