Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snaps: Update snap_notify to include expanded view #1774

Merged
merged 10 commits into from
Dec 16, 2024
19 changes: 18 additions & 1 deletion snaps/reference/snaps-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,9 @@
## `snap_notify`

Displays a [notification](../features/notifications.md) in MetaMask or natively in the OS.
Snaps can trigger a short notification text for actionable or time sensitive information.
Snaps can trigger a short notification text for actionable or time sensitive information.
`inApp` notifications can also include an optional title, content, and footer shown in an
expanded view when a user expands the notification.

#### Parameters

Expand All @@ -874,6 +876,10 @@
We recommend using `type: "inApp"` because there's no guarantee that native notifications are
displayed to the user.
- `message` - A message to show in the notification.
- `title` (optional) - The title of the expanded view, shown when a user expands the notification.
- `content` (optional) - A custom Snap UI shown in the expanded view
- `footer` (optiona) - A custom footer object with `text` and `href`, displayed as an action button

Check failure on line 881 in snaps/reference/snaps-api.md

View workflow job for this annotation

GitHub Actions / Lint / Spelling (.md)

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'optiona'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'optiona'?", "location": {"path": "snaps/reference/snaps-api.md", "range": {"start": {"line": 881, "column": 13}}}, "severity": "ERROR"}
in the footer of the expanded view.

#### Example

Expand All @@ -883,6 +889,17 @@
params: {
type: "inApp",
message: "Hello, world!",
title: "Hello from a Snap",
content: (
<Box>
<Heading>Hello, world!</Heading>
<Text>This is a notification sent from a Snap.</Text>
</Box>
),
footerLink: {
href: "https://snaps.metamask.io",
text: "Find more Snaps"
}
},
})
```
Expand Down
Loading