Tooltips
You may want to show a tooltip when a user hovers over a button, you can use the createTooltip
function of the context for this:
<script>
import { onMount } from 'svelte';
export let context;
let infoButtonEl: HTMLButtonElement;
onMount(() => {
if (infoButtonEl) {
context.createTooltip(infoButtonEl, {
message: 'Tooltip text',
});
}
})
</script>
<button bind:this={infoButtonEl}>info</button>
<style></style>
Updated 3 months ago