Skip to content

Commit 6f3df56

Browse files
ziad-saabalexandratranMontoya
authored
Update docs for Flask 12.4 (#1540)
* Document color and alignment props of <Text> * Document Selector component * Document Snaps RadioGroup component * Document Snaps Tooltip component * Update onHomePage screenshot * Document Snaps Icon component * Document checkbox component * Document `context` parameter of interactive UI * Document FileInput component * minor edits * update "What's new?" * Add default values, replace old custom UI, etc. * Remove old function-based UI examples * Remove mention of deprecated UI component Also move the migration section to the bottom of the page * Fix incorrect link * Remove errant closing tab tags --------- Co-authored-by: Alexandra Tran <alexandratran@protonmail.com> Co-authored-by: Christian Montoya <christian.montoya@consensys.net>
1 parent be0650c commit 6f3df56

19 files changed

+710
-1099
lines changed

docs/whats-new.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ of the [MetaMask developer page](https://metamask.io/developer/).
1111

1212
## September 2024
1313

14+
- Documented new [Snaps custom UI JSX components](/snaps/features/custom-ui) for Flask
15+
version 12.4, and removed documentation for deprecated function-based library.
16+
([#1540](https://github.com/MetaMask/metamask-docs/pull/1540))
1417
- Documented [Snaps user-defined components](/snaps/features/custom-ui/user-defined-components).
1518
([#1557](https://github.com/MetaMask/metamask-docs/pull/1557))
1619
- Updated [Android SDK documentation](/wallet/how-to/use-sdk/mobile/android) with convenience

snaps/assets/custom-ui-checkbox.png

19.7 KB
Loading

snaps/assets/custom-ui-file-input.png

21.2 KB
Loading

snaps/assets/custom-ui-heading.png

1.72 KB
Loading

snaps/assets/custom-ui-icon.png

18.3 KB
Loading
18.6 KB
Loading

snaps/assets/custom-ui-selector.png

31.5 KB
Loading

snaps/assets/custom-ui-tooltip.png

17.9 KB
Loading

snaps/assets/home-page.png

4.87 KB
Loading

snaps/features/custom-ui/dialogs.md

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ description: Display custom alert, confirmation, or prompt screens in MetaMask.
33
sidebar_position: 2
44
---
55

6-
import Tabs from "@theme/Tabs";
7-
import TabItem from "@theme/TabItem";
8-
96
# Dialogs
107

118
You can display a dialog in the MetaMask UI using the
@@ -38,9 +35,6 @@ To display an alert that can only be acknowledged, call
3835
[`snap_dialog`](../../reference/snaps-api.md#snap_dialog) with `type: "alert"`.
3936
The following example displays custom UI that alerts the user when something happens in the system:
4037

41-
<Tabs>
42-
<TabItem value="JSX">
43-
4438
```tsx title="index.tsx"
4539
import { Box, Text, Heading } from "@metamask/snaps-sdk/jsx";
4640

@@ -60,30 +54,6 @@ await snap.request({
6054
// Code that should execute after the alert has been acknowledged.
6155
```
6256

63-
</TabItem>
64-
<TabItem value="Functions" deprecated>
65-
66-
```javascript title="index.js"
67-
import { panel, text, heading } from "@metamask/snaps-sdk"
68-
69-
await snap.request({
70-
method: "snap_dialog",
71-
params: {
72-
type: "alert",
73-
content: panel([
74-
heading("Something happened in the system"),
75-
text("The thing that happened is..."),
76-
]),
77-
},
78-
})
79-
80-
// Code that should execute after the alert has been acknowledged.
81-
```
82-
83-
</TabItem>
84-
</Tabs>
85-
86-
8757
<p align="center">
8858
<img src={require("../../assets/alert-dialog.png").default} alt="Alert dialog example" width="360px" style={{border: "1px solid #DCDCDC"}} />
8959
</p>
@@ -95,9 +65,6 @@ To display a confirmation that can be accepted or rejected, call
9565
The following example displays custom UI that asks the user to confirm whether they would like to
9666
take an action:
9767

98-
<Tabs>
99-
<TabItem value="JSX">
100-
10168
```tsx title="index.tsx"
10269
import { Box, Text, Heading } from "@metamask/snaps-sdk/jsx";
10370

@@ -119,31 +86,6 @@ if (result === true) {
11986
}
12087
```
12188

122-
</TabItem>
123-
<TabItem value="Functions" deprecated>
124-
125-
```javascript title="index.js"
126-
import { panel, text, heading } from "@metamask/snaps-sdk"
127-
128-
const result = await snap.request({
129-
method: "snap_dialog",
130-
params: {
131-
type: "confirmation",
132-
content: panel([
133-
heading("Would you like to take the action?"),
134-
text("The action is..."),
135-
]),
136-
},
137-
})
138-
139-
if (result === true) {
140-
// Do the action.
141-
}
142-
```
143-
144-
</TabItem>
145-
</Tabs>
146-
14789
<p align="center">
14890
<img src={require("../../assets/confirmation-dialog.png").default} alt="Confirmation dialog example" width="360px" style={{border: "1px solid #DCDCDC"}} />
14991
</p>
@@ -156,9 +98,6 @@ Prompt dialogs also accept a `placeholder` value that displays in the input fiel
15698

15799
The following example displays custom UI that prompts the user to enter a wallet address:
158100

159-
<Tabs>
160-
<TabItem value="JSX">
161-
162101
```tsx title="index.tsx"
163102
import { Box, Text, Heading } from "@metamask/snaps-sdk/jsx";
164103

@@ -179,30 +118,6 @@ const walletAddress = await snap.request({
179118
// walletAddress will be a string containing the address entered by the user.
180119
```
181120

182-
</TabItem>
183-
<TabItem value="Functions" deprecated>
184-
185-
```javascript title="index.js"
186-
import { panel, text, heading } from "@metamask/snaps-sdk"
187-
188-
const walletAddress = await snap.request({
189-
method: "snap_dialog",
190-
params: {
191-
type: "prompt",
192-
content: panel([
193-
heading("What is the wallet address?"),
194-
text("Please enter the wallet address to be monitored"),
195-
]),
196-
placeholder: "0x123...",
197-
},
198-
})
199-
200-
// walletAddress will be a string containing the address entered by the user.
201-
```
202-
203-
</TabItem>
204-
</Tabs>
205-
206121
<p align="center">
207122
<img src={require("../../assets/prompt-dialog.png").default} alt="Prompt dialog example" width="360px" style={{border: "1px solid #DCDCDC"}} />
208123
</p>

0 commit comments

Comments
 (0)