This package is part of the @svelte-put family. For contributing guideline and more, refer to its readme.
See the dedicated documentation page here.
<script>
import { computePosition } from '@floating-ui/dom';
import { tooltip } from '@svelte-put/tooltip';
</script>
<button
class="c-btn-primary relative"
use:tooltip={{
content: 'An example tooltip',
class: 'c-tooltip',
compute: async ({ node, tooltip, content }) => {
const { x, y } = await computePosition(node, tooltip, {
placement: 'right',
});
tooltip.style.left = `${x}px`;
tooltip.style.top = `${y}px`;
},
}}
>
A button with tooltip
</button>