|
2 | 2 | import Prism from 'svelte-prismjs';
|
3 | 3 | import { Tooltip, tooltip } from '@svelte-plugins/tooltips';
|
4 | 4 | import ComponentAsContent from './ComponentAsContent.svelte';
|
| 5 | +
|
| 6 | + let showTooltip = false; |
5 | 7 | </script>
|
6 | 8 |
|
7 | 9 | <main>
|
|
54 | 56 | </div>
|
55 | 57 |
|
56 | 58 | <div class="example">
|
57 |
| - <p>This tooltip should appear to the <u use:tooltip={{ content: { component: ComponentAsContent, props: { title: 'Title from props' }}, position: 'left', style: { backgroundColor: 'blue' } }}>left</u> and render the passed component as the tooltip content.</p> |
| 59 | + <p>This tooltip should appear to the <u use:tooltip={{ content: { component: ComponentAsContent, props: { title: 'Title from props' }}, position: 'left', animation: 'slide', style: { backgroundColor: 'blue' } }}>left</u> and render the passed component as the tooltip content.</p> |
58 | 60 | <Prism showLineNumbers={true} code={`
|
59 | 61 | <script>
|
60 | 62 | import ComponentAsContent from './ComponentAsContent.svelte';
|
|
86 | 88 | This tooltip should appear on the <Tooltip content="<b>Tooltip Top</b><p>This is an example of using HTML and content wrapping.</p>" position="top" animation="slide" arrow={false}><i>top</i></Tooltip> when you hover.
|
87 | 89 | </div>
|
88 | 90 |
|
| 91 | + <div class="example"> |
| 92 | + This tooltip should appear <Tooltip content="<b>Tooltip Top</b><p>This is an example of using the 'show' prop.</p>" position="top" animation="slide" bind:show={showTooltip} autoPosition arrow={false} action="prop">on top</Tooltip> when the show button is clicked |
| 93 | + <button on:click={() => (showTooltip = true)}>Show</button> |
| 94 | + <button on:click={() => (showTooltip = false)}>Hide</button> |
| 95 | + |
| 96 | + <Prism showLineNumbers={true} code={` |
| 97 | +
|
| 98 | +<script> |
| 99 | + import { Tooltip } from '@svelte-plugins/tooltips'; |
| 100 | +
|
| 101 | + let showTooltip = false; |
| 102 | +</script> |
| 103 | +
|
| 104 | +<Tooltip |
| 105 | + content="<b>Tooltip Top</b><p>This is an example of using the 'show' prop.</p>" |
| 106 | + position="top" |
| 107 | + animation="slide" |
| 108 | + bind:show={showTooltip} |
| 109 | + autoPosition |
| 110 | + arrow={false} |
| 111 | + action="prop"> |
| 112 | + Should show here |
| 113 | +</Tooltip> |
| 114 | +
|
| 115 | +<button on:click={() => (showTooltip = true)}>Show</button> |
| 116 | +<button on:click={() => (showTooltip = false)}>Hide</button> |
| 117 | +`} /> |
| 118 | + </div> |
| 119 | + |
89 | 120 | <div class="example">
|
90 | 121 | <p>
|
91 | 122 | This tooltip should appear to the
|
|
94 | 125 | position="right"
|
95 | 126 | action="click"
|
96 | 127 | theme="tooltip-theme">
|
97 |
| - <b>right</b> when clicked. |
| 128 | + <b>right</b> |
98 | 129 | </Tooltip>
|
| 130 | + when clicked. |
99 | 131 | </p>
|
100 | 132 | <Prism showLineNumbers={true} code={`
|
101 | 133 | <Tooltip
|
|
0 commit comments