From 04f18ae5e99527fb6cb247af41d3d05e051acd08 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 10:14:22 -0700 Subject: [PATCH] docs(notification): add examples "Prevent default close behavior" (#1380) Follow-up to #1379 --- .../src/pages/components/InlineNotification.svx | 15 +++++++++++++++ docs/src/pages/components/ToastNotification.svx | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/src/pages/components/InlineNotification.svx b/docs/src/pages/components/InlineNotification.svx index 98b461d4..d976ee49 100644 --- a/docs/src/pages/components/InlineNotification.svx +++ b/docs/src/pages/components/InlineNotification.svx @@ -11,6 +11,21 @@ source: Notification/InlineNotification.svelte +### Prevent default close behavior + +`InlineNotification` is a controlled component. Prevent the default close behavior using the `e.preventDefault()` method in the dispatched `on:close` event. + + +
+ Svelte version 3.48.0 or greater is required. +
+
+ + { + e.preventDefault(); + // custom close logic (e.g., transitions) +}} /> + ### Slottable title, subtitle diff --git a/docs/src/pages/components/ToastNotification.svx b/docs/src/pages/components/ToastNotification.svx index 80ddaed4..a430fb8e 100644 --- a/docs/src/pages/components/ToastNotification.svx +++ b/docs/src/pages/components/ToastNotification.svx @@ -3,7 +3,7 @@ source: Notification/ToastNotification.svelte --- @@ -11,6 +11,21 @@ source: Notification/ToastNotification.svelte +### Prevent default close behavior + +`ToastNotification` is a controlled component. Prevent the default close behavior using the `e.preventDefault()` method in the dispatched `on:close` event. + + +
+ Svelte version 3.48.0 or greater is required. +
+
+ + { + e.preventDefault(); + // custom close logic (e.g., transitions) +}} /> + ### Slottable title, subtitle, caption