svelte-popperjs

Popper for Svelte with actions, no wrapper components required!

MIT License

Downloads
23.8K
Stars
113
Committers
4

Bot releases are hidden (Show)

svelte-popperjs - Access the popper instance when creating popper actions!

Published by bryanmylee almost 4 years ago

If access is needed to the raw Popper instance created by the actions, you can reference the third element returned by createPopperActions. The third element is a function that will return the current Popper instance used by the actions.

Using the raw Popper instance to manually recompute the popper's position.

<script>
  import { createPopperActions } from 'svelte-popperjs';
  const [popperRef, popperContent, getInstance] = createPopperActions();
  
  async function refreshTooltip() {
    const newState = await getInstance().update();
  }
</script>

Tests were also added to ensure that no lifecycle leaks occur.