Skip to content

Commit a7bd964

Browse files
committed
refactor(demo): add example using prop to show/hide tooltip
1 parent 1a77a10 commit a7bd964

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

docs/src/App.svelte

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,33 @@
8989
</div>
9090

9191
<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}>on top</Tooltip> when the show button is clicked
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
9393
<button on:click={() => (showTooltip = true)}>Show</button>
9494
<button on:click={() => (showTooltip = false)}>Hide</button>
95-
</div>
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>
96119

97120
<div class="example">
98121
<p>

0 commit comments

Comments
 (0)