
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
svelte-popperjs
Advanced tools
Popper for Svelte with actions, no wrapper components or component bindings required!
Other Popper libraries for Svelte (including the official @popperjs/svelte
library) use a wrapper component that takes the required DOM elements as props. Not only does this require multiple bind:this
, you also have to pollute your script
tag with multiple DOM references.
We can do better with Svelte actions!
$ npm i -D svelte-popperjs
Since Svelte automatically bundles all required dependencies, you only need to install this package as a dev dependency with the -D
flag.
createPopperActions
returns a pair of actions to be used on the reference and popper elements.
The content action takes an options object for configuring the popper instance.
A Svelte version of the standard tutorial.
styles not included*
<script>
import { createPopperActions } from 'svelte-popperjs';
const [ popperRef, popperContent ] = createPopperActions();
const popperOptions = {
modifiers: [
{ name: 'offset', options: { offset: [0, 8] } }
],
};
let showTooltip = false;
</script>
<button
use:popperRef
on:mouseenter={_ => showTooltip = true}
on:mouseleave={_ => showTooltip = false}
>
My button
</button>
{#if showTooltip}
<div id="tooltip" use:popperContent={popperOptions}>
My tooltip
<div id="arrow" data-popper-arrow />
</div>
{/if}
FAQs
Popper for Svelte with actions, no wrapper components required!
The npm package svelte-popperjs receives a total of 5,851 weekly downloads. As such, svelte-popperjs popularity was classified as popular.
We found that svelte-popperjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.