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
+28-16Lines changed: 28 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Overview
4
4
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.
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.
6
6
7
7
## Usage
8
8
```html
@@ -19,30 +19,41 @@
19
19
## Slots
20
20
21
21
### Trigger
22
-
The only part visible on page load, the trigger opens the modal window. The trigger can be a button, a cta or a link. While it is part of the modal web component, it does not contain any intrinsic styles.
22
+
The only part visible on page load, the trigger opens the modal window. The trigger can be a button, a cta or a link. While it is part of the modal web component, it does not contain any intrinsic styles.
23
23
24
24
### Header
25
-
The header is an optional slot that appears at the top of the modal window. It should be a header tag (h2-h6).
25
+
The header is an optional slot that appears at the top of the modal window. It should be a header tag (h2-h6).
26
26
27
27
### Default slot
28
28
The default slot can contain any type of content. When the header is not present this unnamed slot appear at the top of the modal window (to the left of the close button). Otherwise it will appear beneath the header.
29
29
30
-
## Events
30
+
## API
31
31
32
-
### openModal
33
-
Fires when a user clicks on the trigger. openModal 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").openModal(event).`
32
+
### open
34
33
35
-
### closeModal
36
-
Fires when either a user clicks on either the close button or the overlay. closeModal 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").closeModal(event).`
34
+
### close
37
35
38
-
### Dependencies
39
-
Make sure you have [Polyserve][polyserve] and [Web Component Tester][web-component-tester] installed.
36
+
### toggle
40
37
41
-
npm install -g polyserve web-component-tester
38
+
## Events
42
39
43
-
## Dev
40
+
### 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).`
44
42
45
-
npm start
43
+
```
44
+
detail: {
45
+
open: true
46
+
}
47
+
```
48
+
49
+
### 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).`
51
+
52
+
```
53
+
detail: {
54
+
open: false
55
+
}
56
+
```
46
57
47
58
## Test
48
59
@@ -54,13 +65,14 @@ Make sure you have [Polyserve][polyserve] and [Web Component Tester][web-compone
54
65
55
66
## Demo
56
67
57
-
Run `npm start` and Polyserve will start a server and open your default browser to the demo page of the element.
68
+
From the PFElements root directory, run:
69
+
70
+
npm start
58
71
59
72
## Code style
60
73
61
-
Modal (and all PatternFly Elements) 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.
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.
0 commit comments