|
| 1 | +--- |
| 2 | +description: Interactive playground for tooltip options. |
| 3 | +--- |
| 4 | +<section> |
| 5 | + <fieldset> |
| 6 | + <legend>Position</legend> |
| 7 | + <select id="position"> |
| 8 | + <option value="top" selected>top</option> |
| 9 | + <option value="top-start">top-start</option> |
| 10 | + <option value="top-end">top-end</option> |
| 11 | + <option value="bottom">bottom</option> |
| 12 | + <option value="bottom-start">bottom-start</option> |
| 13 | + <option value="bottom-end">bottom-end</option> |
| 14 | + <option value="left">left</option> |
| 15 | + <option value="left-start">left-start</option> |
| 16 | + <option value="left-end">left-end</option> |
| 17 | + <option value="right">right</option> |
| 18 | + <option value="right-start">right-start</option> |
| 19 | + <option value="right-end">right-end</option> |
| 20 | + </select> |
| 21 | + </fieldset> |
| 22 | + |
| 23 | + <fieldset> |
| 24 | + <legend>Alignment</legend> |
| 25 | + <select id="alignment"> |
| 26 | + <option value="" selected>(default: center)</option> |
| 27 | + <option value="start">start</option> |
| 28 | + <option value="end">end</option> |
| 29 | + </select> |
| 30 | + </fieldset> |
| 31 | + |
| 32 | + <fieldset> |
| 33 | + <legend>Delays</legend> |
| 34 | + <label>Entry delay (ms): <input id="entry-delay" type="number" value="300" min="0" step="50"></label> |
| 35 | + <label>Exit delay (ms): <input id="exit-delay" type="number" value="300" min="0" step="50"></label> |
| 36 | + </fieldset> |
| 37 | + |
| 38 | + <fieldset> |
| 39 | + <legend>Flip</legend> |
| 40 | + <label><input id="no-flip" type="checkbox"> Disable flip</label> |
| 41 | + </fieldset> |
| 42 | +</section> |
| 43 | + |
| 44 | +<section class="demo-area"> |
| 45 | + <pf-v6-tooltip id="demo-tooltip" |
| 46 | + content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis."> |
| 47 | + <pf-v5-button>Tooltip</pf-v5-button> |
| 48 | + </pf-v6-tooltip> |
| 49 | +</section> |
| 50 | + |
| 51 | +<script type="module"> |
| 52 | + import '@patternfly/elements/pf-v5-button/pf-v5-button.js'; |
| 53 | + import '@patternfly/elements/pf-v6-tooltip/pf-v6-tooltip.js'; |
| 54 | + |
| 55 | + const tooltip = document.getElementById('demo-tooltip'); |
| 56 | + |
| 57 | + document.getElementById('position').addEventListener('change', function(e) { |
| 58 | + tooltip.position = e.target.value; |
| 59 | + }); |
| 60 | + |
| 61 | + document.getElementById('alignment').addEventListener('change', function(e) { |
| 62 | + tooltip.alignment = e.target.value || undefined; |
| 63 | + }); |
| 64 | + |
| 65 | + document.getElementById('entry-delay').addEventListener('input', function(e) { |
| 66 | + tooltip.entryDelay = Number(e.target.value); |
| 67 | + }); |
| 68 | + |
| 69 | + document.getElementById('exit-delay').addEventListener('input', function(e) { |
| 70 | + tooltip.exitDelay = Number(e.target.value); |
| 71 | + }); |
| 72 | + |
| 73 | + document.getElementById('no-flip').addEventListener('change', function(e) { |
| 74 | + tooltip.noFlip = e.target.checked; |
| 75 | + }); |
| 76 | +</script> |
| 77 | + |
| 78 | +<style> |
| 79 | + section { |
| 80 | + padding: 1em 2em; |
| 81 | + } |
| 82 | + |
| 83 | + .demo-area { |
| 84 | + padding: 8em 2em; |
| 85 | + text-align: center; |
| 86 | + } |
| 87 | + |
| 88 | + fieldset { |
| 89 | + margin-block-end: 0.5em; |
| 90 | + border: 1px solid #ccc; |
| 91 | + border-radius: 4px; |
| 92 | + } |
| 93 | + |
| 94 | + label { |
| 95 | + margin-inline-end: 1em; |
| 96 | + } |
| 97 | + |
| 98 | + input[type="number"] { |
| 99 | + width: 5em; |
| 100 | + } |
| 101 | +</style> |
0 commit comments