|
1 | 1 | # Popover |
2 | 2 |
|
3 | | -<component-status cx-design="partial" ux="beta"></component-status> |
| 3 | +<component-status cx-design="complete" ux="rc"></component-status> |
4 | 4 |
|
5 | 5 | ## Usage |
6 | 6 |
|
7 | | -### Simple case |
| 7 | +### Using value of `oui-popover` attribute |
| 8 | + |
| 9 | +```html:preview |
| 10 | +<button type="button" |
| 11 | + class="oui-button oui-button_primary" |
| 12 | + oui-popover="This is an awesome popover content."> |
| 13 | + Click to toggle popover |
| 14 | +</button> |
| 15 | +``` |
| 16 | + |
| 17 | +### Using value of `title` attribute |
| 18 | + |
| 19 | +```html:preview |
| 20 | +<button type="button" |
| 21 | + class="oui-button oui-button_primary" |
| 22 | + title="This is an awesome popover content." |
| 23 | + oui-popover> |
| 24 | + Click to toggle popover |
| 25 | +</button> |
| 26 | +``` |
| 27 | + |
| 28 | +### Using a template with `oui-popover-template` attribute |
| 29 | + |
| 30 | +```html:preview |
| 31 | +<button type="button" |
| 32 | + class="oui-button oui-button_primary" |
| 33 | + oui-popover |
| 34 | + oui-popover-template="popover.html"> |
| 35 | + Click to toggle popover |
| 36 | +</button> |
| 37 | +
|
| 38 | +<script type="text/ng-template" id="popover.html"> |
| 39 | +<p ng-init="$ctrl.awesome = 'awesome'">This is an <strong ng-bind="$ctrl.awesome"></strong> popover content.</p> |
| 40 | +<p><a href="#">The quick brown fox jumps over the lazy dog</a></p> |
| 41 | +</script> |
| 42 | +``` |
| 43 | + |
| 44 | +**Note**: This method use `ngInclude` to add the template in a popover. The content of your template will be compiled with a **new** scope. See [ngInclude](https://docs.angularjs.org/api/ng/directive/ngInclude). |
| 45 | + |
| 46 | +### Using `oui-popover` component |
8 | 47 |
|
9 | 48 | ```html:preview |
10 | 49 | <oui-popover> |
|
15 | 54 | </oui-popover> |
16 | 55 | ``` |
17 | 56 |
|
| 57 | +**Note**: This use is **deprecated** and will be removed in the next major version |
| 58 | + |
18 | 59 | ### All directions |
19 | 60 |
|
20 | 61 | ```html:preview |
21 | | -<oui-popover placement="right"> |
22 | | - <button type="button" class="oui-button oui-button_primary" oui-popover-trigger>Popover on right</button> |
23 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
24 | | -</oui-popover> |
25 | | -
|
26 | | -<oui-popover placement="top"> |
27 | | - <button type="button" class="oui-button oui-button_primary" oui-popover-trigger>Popover on top</button> |
28 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
29 | | -</oui-popover> |
30 | | -
|
31 | | -<oui-popover placement="bottom"> |
32 | | - <button type="button" class="oui-button oui-button_primary" oui-popover-trigger>Popover on bottom</button> |
33 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
34 | | -</oui-popover> |
35 | | -
|
36 | | -<oui-popover placement="left"> |
37 | | - <button type="button" class="oui-button oui-button_primary" oui-popover-trigger>Popover on left</button> |
38 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
39 | | -</oui-popover> |
| 62 | +<button type="button" class="oui-button oui-button_primary" |
| 63 | + oui-popover="This is an awesome popover content." |
| 64 | + oui-popover-placement="right"> |
| 65 | + Popover on right |
| 66 | +</button> |
| 67 | +
|
| 68 | +<button type="button" class="oui-button oui-button_primary" |
| 69 | + oui-popover="This is an awesome popover content." |
| 70 | + oui-popover-placement="top"> |
| 71 | + Popover on top |
| 72 | +</button> |
| 73 | +
|
| 74 | +<button type="button" class="oui-button oui-button_primary" |
| 75 | + oui-popover="This is an awesome popover content." |
| 76 | + oui-popover-placement="bottom"> |
| 77 | + Popover on bottom |
| 78 | +</button> |
| 79 | +
|
| 80 | +<button type="button" class="oui-button oui-button_primary" |
| 81 | + oui-popover="This is an awesome popover content." |
| 82 | + oui-popover-placement="left"> |
| 83 | + Popover on left |
| 84 | +</button> |
40 | 85 | ``` |
41 | 86 |
|
42 | 87 | ### Alignments |
43 | 88 |
|
44 | 89 | ```html:preview |
45 | | -<oui-popover placement="bottom-start"> |
46 | | - <button type="button" class="oui-button oui-button_primary" oui-popover-trigger>Align start</button> |
47 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
48 | | -</oui-popover> |
49 | | -
|
50 | | -<oui-popover placement="bottom-end"> |
51 | | - <button type="button" class="oui-button oui-button_primary" oui-popover-trigger>Align end</button> |
52 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
53 | | -</oui-popover> |
| 90 | +<button type="button" class="oui-button oui-button_primary" |
| 91 | + oui-popover="This is an awesome popover content." |
| 92 | + oui-popover-placement="bottom-start"> |
| 93 | + Align start |
| 94 | +</button> |
| 95 | +
|
| 96 | +<button type="button" class="oui-button oui-button_primary" |
| 97 | + oui-popover="This is an awesome popover content." |
| 98 | + oui-popover-placement="bottom-end"> |
| 99 | + Align end |
| 100 | +</button> |
54 | 101 | ``` |
55 | 102 |
|
56 | 103 | ### Help Popover |
57 | 104 |
|
58 | 105 | ```html:preview |
59 | | -<oui-popover> |
60 | | - <button type="button" class="oui-popover-button" oui-popover-trigger></button> |
61 | | - <oui-popover-content>This is an awesome popover content.</oui-popover-content> |
62 | | -</oui-popover> |
| 106 | +<button type="button" class="oui-popover-button" oui-popover="This is an awesome popover content."></button> |
63 | 107 | ``` |
64 | 108 |
|
65 | | -## API |
| 109 | +### Dynamic popover text |
66 | 110 |
|
67 | | -### oui-popover |
68 | | - |
69 | | -The component for a popover. |
70 | | - |
71 | | -Availability: |
72 | | - |
73 | | - - Element |
74 | | - |
75 | | -| Attribute | Type | Binding | Values | Default | Description |
76 | | -| ---- | ---- | ---- | ---- | ---- | ---- |
77 | | -| `placement` | string | @? | See [Popper placements](https://popper.js.org/popper-documentation.html#Popper.placements) | `right` | modifier for alignment |
78 | | - |
79 | | -### oui-popover-trigger |
| 111 | +```html:preview |
| 112 | +<input type="text" class="oui-input oui-input_inline" |
| 113 | + ng-init="$ctrl.popoverText = 'Lorem ipsum'" |
| 114 | + ng-model="$ctrl.popoverText" |
| 115 | + oui-popover="{{ $ctrl.popoverText }}"> |
| 116 | +``` |
80 | 117 |
|
81 | | -The directive that triggers the popover apparition. |
| 118 | +## API |
82 | 119 |
|
83 | | -Availability: |
| 120 | +| Attribute | Type | Binding | One-time Binding | Values | Default | Description |
| 121 | +| ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| 122 | +| `oui-popover` | string | @ | no | n/a | `title` attribute | popover content |
| 123 | +| `oui-popover-template` | string | @? | no | n/a | n/a | popover content template |
| 124 | +| `oui-popover-placement` | string | @? | yes | See [Popper placements](https://popper.js.org/popper-documentation.html#Popper.placements) | `right` | modifier for alignment |
84 | 125 |
|
85 | | - - Element |
86 | | - - Attribute |
| 126 | +## Deprecated |
87 | 127 |
|
88 | | -### oui-popover-content |
| 128 | +### Attributes |
89 | 129 |
|
90 | | -The directive that wrap the popover content. |
| 130 | +* `placement`: Replaced by `oui-popover-placement` attribute |
91 | 131 |
|
92 | | -Availability: |
| 132 | +### Components |
93 | 133 |
|
94 | | - - Element |
95 | | - - Attribute |
| 134 | +* `oui-popover`: Replaced by `oui-popover` attribute |
| 135 | +* `oui-popover-trigger`: Replaced by `oui-popover` attribute |
| 136 | +* `oui-popover-content`: Replaced by `oui-popover` attribute |
0 commit comments