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
Copy file name to clipboardExpand all lines: elements/pfe-modal/README.md
+34-4Lines changed: 34 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,12 @@
1
-
# PatternFly Modal Element
1
+
# PFElements Modal Element
2
2
3
3
## Overview
4
4
5
5
`pfe-modal` is a self-contained modal window that is hidden on page load and (when activated) restricts the user from interacting with content in the main window.
<h2slot="pfe-modal--header">Modal with a header</h2>
25
+
<p>Lorem ipsum dolor sit amet, <ahref="#foo">consectetur adipisicing</a> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
26
+
<pfe-cta>
27
+
<ahref="#bar">Learn more</a>
28
+
</pfe-cta>
29
+
</pfe-modal>
30
+
```
19
31
## Slots
20
32
21
33
### Trigger
@@ -31,14 +43,32 @@ The default slot can contain any type of content. When the header is not present
31
43
32
44
### open
33
45
46
+
Manually opens a modal. Return the modal that has been opened.
47
+
48
+
```
49
+
document.querySelector("pfe-modal").open();
50
+
```
51
+
34
52
### close
35
53
54
+
Manually closes a modal. Returns the modal that has been closed.
55
+
56
+
```
57
+
document.querySelector("pfe-modal").close();
58
+
```
59
+
36
60
### toggle
37
61
62
+
Manually toggles a modal. Returns the modal that has been toggled.
63
+
64
+
```
65
+
document.querySelector("pfe-modal").toggle();
66
+
```
67
+
38
68
## Events
39
69
40
70
### pfe-modal:open
41
-
Fires when a user clicks on the trigger. open can be accessed from outside the web component by getting the modal that you want to fire and passing in the firing event: `document.querySelector("pfe-modal#custom-id").open(event).`
71
+
Fires when a user clicks on the trigger or manually opens a modal.
42
72
43
73
```
44
74
detail: {
@@ -47,7 +77,7 @@ detail: {
47
77
```
48
78
49
79
### pfe-modal:close
50
-
Fires when either a user clicks on either the close button or the overlay. close can be accessed from outside the web component by getting the modal that you want to fire and passing in the firing event: `document.querySelector("pfe-modal#custom-id").close(event).`
80
+
Fires when either a user clicks on either the close button or the overlay or manually closes a modal.
51
81
52
82
```
53
83
detail: {
@@ -71,7 +101,7 @@ From the PFElements root directory, run:
71
101
72
102
## Code style
73
103
74
-
Collapsible (and all PFElements) use [Prettier][prettier] to auto-format JS and JSON. The style rules get applied when you commit a change. If you choose to, you can [integrate your editor][prettier-ed] with Prettier to have the style rules applied on every save.
104
+
Modal (and all PFElements) use [Prettier][prettier] to auto-format JS and JSON. The style rules get applied when you commit a change. If you choose to, you can [integrate your editor][prettier-ed] with Prettier to have the style rules applied on every save.
0 commit comments