Skip to content

Commit 1337f28

Browse files
authored
New power apps snipet (#108)
2 parents 118cc08 + 531b2f9 commit 1337f28

File tree

7 files changed

+473
-0
lines changed

7 files changed

+473
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Notification Toaster
2+
3+
An alternate inapp notification system,
4+
5+
![Notification toaster](./assets/notification-toaster-demo.gif)
6+
7+
## Authors
8+
9+
Snippet|Author
10+
--------|---------
11+
David Zoonekyndt | [GitHub](https://github.com/DavidZoon) ([LinkedIn](https://www.linkedin.com/in/david-zoonekyndt/) )
12+
13+
## Minimal path to awesome
14+
15+
1. Open your canvas app in **Power Apps**
16+
2. Copy the contents of the **[YAML-file](./source/notification-toaster.yaml)**
17+
3. Go to Tree view >> Components
18+
4. Press Ctrl+V to paste YAML content
19+
5. Back to Tree view >> Screens and insert NotificationToaster in you application from custom category
20+
21+
### ⚠️⚠️⚠️ Important:
22+
23+
Paste YAML snipet in components view !
24+
25+
To show a notification, use :
26+
```
27+
NotificationToaster_1.Notify( //replace 'NotificationToaster_1' by the name of the component in your app screen
28+
"✅ Success", // Mandatory : Title of your notification in bold text
29+
NotificationType.Success, // Optionnal : NotificationType.Information by default
30+
"Your settings have been saved successfully.", // Optional : Detailled notifiction text
31+
3000) // Optionnal : The notification lifetime will be calculated based on the number of characters to be read and the 'ReadingSpeed' in the 'Theme' parameter
32+
```
33+
34+
Componnent positionning : To position the component in the bottom right corner of your screen, use the following positioning formulas:
35+
36+
x: `Parent.Width-Self.Width`
37+
y: `Parent.Height-Self.Height`
38+
39+
All settings and instruction are in the 'Theme' parameter :
40+
<img width="800" alt="sample_tablet_landscape" src="./assets/notification-toaster-parameters.png" />
41+
42+
## Code
43+
**[YAML-file](./source/notification-toaster.yaml)**
44+
45+
**[Demo screen (import component first ! ) YAML-file](./source/notification-toaster-demo-screen-import-compenent-first.yaml)**
46+
47+
## Disclaimer
48+
49+
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
50+
51+
<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-snippets/power-apps/Notification-toaster" aria-hidden="true" />
1.38 MB
Loading
375 KB
Loading
164 KB
Loading
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[
2+
{
3+
"$schema": "https://developer.microsoft.com/en-us/json-schemas/pnp/samples/v1.0/metadata-schema.json",
4+
"name": "pnp-powerplatform-snippets-notification-toaster",
5+
"version": "1.0.0.0",
6+
"source": "pnp",
7+
"creationDateTime": "2025-08-06T00:00:00.000Z",
8+
"updateDateTime": "2025-08-06T00:00:00.000Z",
9+
"title": "Notification toaster",
10+
"shortDescription": "An alternate way to push in app notifications",
11+
"longDescription": [
12+
"Allows to display notification with a custom duration and some nice effets : progress bar, glassmorphism..."
13+
],
14+
"url": "https://github.com/DavidZoon/powerplatform-snippets/blob/main/power-apps/Notification-toaster/",
15+
"products": [
16+
"Power Platform",
17+
"Power Apps",
18+
"powerplatform-snippets",
19+
"power-apps-snippets"
20+
],
21+
"tags": [],
22+
"categories": [],
23+
"metadata": [
24+
{
25+
"key": "Product",
26+
"value": "Power Apps"
27+
},
28+
{
29+
"key": "Type",
30+
"value": "Snippet"
31+
}
32+
],
33+
"thumbnails": [
34+
{
35+
"type": "image",
36+
"order": 100,
37+
"url": "https://github.com/pnp/powerplatform-snippets/blob/edee8150a614d2e62bd84b02dde5e41609eb7ea5/power-apps/Notification-Toaster/assets/notification-toaster.png",
38+
"alt": "Preview PNG"
39+
}
40+
],
41+
"authors": [
42+
{
43+
"gitHubAccount": "DavidZoon",
44+
"name": "David Zoonekyndt",
45+
"pictureUrl": "https://github.com/DavidZoon.png"
46+
}
47+
]
48+
}
49+
]
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
Screens:
2+
Notification Toaster demo:
3+
Properties:
4+
BackgroundImage: ="https://images.unsplash.com/photo-1558485694-21e9d4f2bd36?q=80&w=1548&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
5+
ImagePosition: =ImagePosition.Fill
6+
Children:
7+
- Container1:
8+
Control: GroupContainer@1.3.0
9+
Variant: AutoLayout
10+
Properties:
11+
DropShadow: =DropShadow.Bold
12+
Fill: =RGBA(255, 255, 255, 0.75)
13+
Height: =488
14+
LayoutAlignItems: =LayoutAlignItems.Center
15+
LayoutDirection: =LayoutDirection.Vertical
16+
LayoutGap: =40
17+
LayoutJustifyContent: =LayoutJustifyContent.Center
18+
RadiusBottomLeft: =20
19+
RadiusBottomRight: =20
20+
RadiusTopLeft: =20
21+
RadiusTopRight: =20
22+
Width: =404
23+
X: =424
24+
Y: =140
25+
Children:
26+
- ButtonRandomNotification:
27+
Control: Classic/Button@2.2.0
28+
Properties:
29+
Fill: =App.Theme.Colors.Lighter20
30+
Height: =37
31+
OnSelect: |-
32+
=Switch(RandBetween(1,4),
33+
1,
34+
Select(ButtonShortNotification),
35+
2,
36+
Select(ButtonMediumNotification),
37+
3,
38+
Select(ButtonLongNotification),
39+
4,
40+
Select(ButtonVeryLongNotification)
41+
)
42+
TabIndex: =-1
43+
Text: ="Random notification"
44+
Width: =282
45+
X: =492
46+
Y: =268
47+
- ButtonShortNotification:
48+
Control: Classic/Button@2.2.0
49+
Properties:
50+
Height: =37
51+
OnSelect: =NotificationToaster_1.Notify("✅ Success",NotificationType.Success,"Your settings have been saved successfully.",3000);
52+
TabIndex: =-1
53+
Text: ="Short notification"
54+
Width: =282
55+
X: =492
56+
Y: =107
57+
- ButtonMediumNotification:
58+
Control: Classic/Button@2.2.0
59+
Properties:
60+
Height: =37
61+
OnSelect: =NotificationToaster_1.Notify("⚠️ Session Expiring",NotificationType.Warning,"Your session is about to expire due to inactivity. To protect your account, you will be logged out in two minutes. Please save any unsaved work now.")
62+
TabIndex: =-1
63+
Text: ="Medium notification"
64+
Width: =282
65+
X: =492
66+
Y: =159
67+
- ButtonLongNotification:
68+
Control: Classic/Button@2.2.0
69+
Properties:
70+
Height: =37
71+
OnSelect: =NotificationToaster_1.Notify("ℹ️ New Feature Available", NotificationType.Information,"We're excited to announce the arrival of our new ""Project Templates"" feature! You can now create and save custom project layouts to streamline your workflow. To get started, simply navigate to the ""Projects"" tab and select ""Create from Template."" We hope this update helps you work more efficiently.")
72+
TabIndex: =-1
73+
Text: ="Long notification"
74+
Width: =282
75+
X: =492
76+
Y: =211
77+
- ButtonVeryLongNotification:
78+
Control: Classic/Button@2.2.0
79+
Properties:
80+
Height: =37
81+
OnSelect: |-
82+
=NotificationToaster_1.Notify("❌ Payment Authorization Failed action required immediatly", NotificationType.Error,"We were unable to process your payment for order #855-24B. The authorization was declined by your bank, which can happen due to insufficient funds, an incorrect card number, or security limits set by your financial institution. Please double-check your payment details and try again. If the issue persists after verifying your information, we recommend contacting your bank directly for more details before attempting another transaction. We have saved your cart for your convenience.")
83+
TabIndex: =-1
84+
Text: ="Very long notification"
85+
Width: =282
86+
X: =492
87+
Y: =260
88+
- Timer_On_Off:
89+
Control: Toggle@1.1.5
90+
Properties:
91+
AlignInContainer: =AlignInContainer.Center
92+
Checked: =true
93+
Label: ="Timer On / Off"
94+
Width: =200
95+
- NotificationToaster_1:
96+
Control: CanvasComponent
97+
ComponentName: NotificationToaster
98+
Properties:
99+
ContentLanguage: ="" // YAML Snipet component by David Zoonekyndt https://dz13n.wordpress.com/
100+
Height: |-
101+
=// Adjusts the height according to the number of notifications without exceeding the screen height, do not modify
102+
Min(NotificationToaster_1.AutoHeight,App.ActiveScreen.Height)
103+
Theme: |-
104+
=/*---------------- Instructions ------------------
105+
To Notify, use :
106+
107+
NotificationToaster_1.Notify( //replace 'NotificationToaster_1' by the name of the component in your app screen
108+
"✅ Success", // Mandatory : Title of your notification in bold text
109+
NotificationType.Success, // Optionnal : NotificationType.Information by default
110+
"Your settings have been saved successfully.", // Optional : Detailled notifiction text
111+
3000 // Optionnal : The notification lifetime will be calculated based on the number of characters to be read and the 'ReadingSpeed' in the 'Theme' parameter
112+
113+
Componnent positionning : To position the component in the bottom right corner of your screen, use the following positioning formulas:
114+
x: Parent.Width-Self.Width
115+
y: Parent.Height-Self.Height
116+
117+
*/
118+
{Transparency:"99", // in hexadecimal : from 00(transparent) to ff (opaque)
119+
FontSize:11,
120+
ReadingSpeed:23, // chars per second, used to calculate default notification duration
121+
SuccessTextColor:"#ffffff",
122+
SuccessBckgndColor:"#009944",
123+
ErrorTextColor:"#ffffff",
124+
ErrorBckgndColor:"#cf000f",
125+
WarningTextColor:"#ffffff",
126+
WarningBckgndColor:"#f0541e",
127+
InformationTextColor:"#000000",
128+
InformationBckgndColor:"#ffffff"
129+
}
130+
Timer: =Timer_On_Off.Checked
131+
Width: =420
132+
X: =Parent.Width-Self.Width
133+
Y: =Parent.Height-Self.Height

0 commit comments

Comments
 (0)