@svelte-put/tooltip
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@svelte-put/tooltip

npm.badge bundlephobia.badge docs.badge repl.badge

Type-safe, headless, extensible tooltip builder via Svelte action use:tooltip

svelte-put

This package is part of the @svelte-put family. For contributing guideline and more, refer to its readme.

Usage & Documentation

See the dedicated documentation page here.

Quick Start

<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>

Changelog

Package Sidebar

Install

npm i @svelte-put/tooltip

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

27.9 kB

Total Files

9

Last publish

Collaborators

  • vnphanquang