You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Motivation
Migrating component `Modal` to Svelte 5.
# Breaking Changes
The interface changes:
- The slots `title`, `headerLeft`, `headerRight`, `subTitle` and
`footer` are migrated to `Snippet`.
- No event `nnsClose` bubbling up anymore, use the prop `onClose` that
receives the callback function.
- No event `introend` bubbling up anymore, use the prop `onIntroend`
that receives the callback function.
- No event `click` bubbling up anymore, use the prop `onClick` that
receives the callback function.
---------
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: src/routes/(split)/components/modal/+page.md
+30-31Lines changed: 30 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,9 @@
8
8
9
9
# Modal
10
10
11
-
A Modal is a dialog that appears on top of the app's content, and must be dismissed by the app before interaction can resume. It is useful as a select component when there are a lot of options to choose from, or when filtering items in a list, as well as many other use cases.
11
+
A Modal is a dialog that appears on top of the app's content and must be dismissed by the app before interaction can resume.
12
+
It is useful as a select component when there are a lot of options to choose from,
13
+
or when filtering items in a list, as well as many other use cases.
12
14
13
15
```javascript
14
16
<script lang="ts">
@@ -19,38 +21,35 @@ A Modal is a dialog that appears on top of the app's content, and must be dismis
|`title`| The title of the modal. Displayed in a toolbar with a "Close" icon button on the right side. |
44
-
|`header-left`| Position content on the left side of the header title, such as additional buttons. |
45
-
|`header-right`| Position content on the right side of the header title, such as additional buttons, or replace the close button with a custom button by setting `disablePointerEvents` to `true`. |
46
-
|`toolbar`| A sticky toolbar displayed at the bottom of the modal. Available for "alert" only. |
47
-
|`sub-title`| A slot below the title but outside of the content card. |
|`nnsClose`| Triggered when a closing interaction element is clicks - close button or backdrop. Note that the modal itself does not update the `visible` property. | No detail |
|`visible`| Display or hide the modal. |`boolean`|`false`|
36
+
|`role`| The modal is either a dialog meant for getting work done or an alert that requires immediate attention. |`dialog` or `alert`|`dialog`|
37
+
|`testId`| Add a `data-tid` attribute to the DOM, useful for test purpose. |`string` or `undefined`|`undefined`|
38
+
|`disablePointerEvents`| Disable interactive elements - close actions - of the modal. |`boolean`|`false`|
39
+
|`onClose`| Triggered when a closing interaction element is clicks - close button or backdrop. Note that the modal itself does not update the `visible` property. |`() => void`|`undefined`|
40
+
|`onIntroEnd`| Callback triggered when the intro transition ends. |`() => void`|`undefined`|
41
+
|`onClick`| Callback triggered when the modal is clicked. |`() => void`|`undefined`|
|`title`| The title of the modal. Displayed in a toolbar with a "Close" icon button on the right side. |
49
+
|`header-left`| Position content on the left side of the header title, such as additional buttons. |
50
+
|`header-right`| Position content on the right side of the header title, such as additional buttons, or replace the close button with a custom button by setting `disablePointerEvents` to `true`. |
51
+
|`toolbar`| A sticky toolbar displayed at the bottom of the modal. Available for "alert" only. |
52
+
|`sub-title`| A snippet below the title but outside of the content card. |
54
53
55
54
## Utility Classes
56
55
@@ -64,10 +63,10 @@ A Modal is a dialog that appears on top of the app's content, and must be dismis
0 commit comments