npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@adhesivejs/svelte

v0.7.7

Published

Svelte adapter for Adhesive - A modern, performant, lightweight, dependency free, cross platform solution for flexible sticky positioned elements

Readme

Adhesive Svelte

Svelte adapter for Adhesive - A modern, performant, lightweight, dependency free, cross platform solution for flexible sticky positioned elements.

npm version jsr version npm downloads bundle size license

🛠️ Installation

# ✨ Auto-detect
npx nypm install @adhesivejs/svelte

# npm
npm install @adhesivejs/svelte

# yarn
yarn add @adhesivejs/svelte

# pnpm
pnpm install @adhesivejs/svelte

# bun
bun install @adhesivejs/svelte

# deno
deno install @adhesivejs/svelte

🎨 Usage

Basic Example

<script lang="ts">
  import { adhesive } from '@adhesivejs/svelte';
</script>

<header {@attach adhesive({ position: "top" })}>
  This header will stick to the top
</header>

<main>
  <p>Your main content here...</p>
</main>

Advanced Example

<script lang="ts">
  import { adhesive, type AdhesivePosition } from "@adhesivejs/svelte";

  let enabled = $state(true);
  let position = $state<AdhesivePosition>("top");
  let boundingEl = $state<HTMLElement | null>(null);
</script>

<div bind:this={boundingEl} style="height: 200vh">
  <button on:click={() => enabled = !enabled}>
    {enabled ? "Disable" : "Enable"} Sticky
  </button>

  <button on:click={() => position = position === "top" ? "bottom" : "top"}>
    Switch to {position === "top" ? "bottom" : "top"}
  </button>

  <div
    {@attach adhesive({
      boundingEl,
      position,
      offset: 20,
      enabled,
      zIndex: 999,
      initialClassName: "custom-initial",
      fixedClassName: "custom-fixed",
      relativeClassName: "custom-relative"
    })}
    class="sticky-element"
  >
    <h2>Dynamic Sticky Element</h2>
    <p>Position: {position} | Enabled: {enabled ? "Yes" : "No"}</p>
  </div>

  <div style="height: 150vh; background: linear-gradient(to bottom, #f0f0f0, #ffffff)">
    <p>Scroll to see the sticky behavior in action!</p>
  </div>
</div>

API Reference

adhesive Attachment

A Svelte attachment that applies sticky positioning to elements with advanced configuration options.

Parameters:

  • options: Configuration options (optional)

AdhesiveAttachmentOptions:

| Option | Type | Default | Description | | ------------------- | ------------------------- | ---------------------------- | ---------------------------------------------- | | boundingEl | HTMLElement | string | document.body | The element that defines the sticky boundaries | | position | 'top' \| 'bottom' | 'top' | Where the element should stick | | offset | number | 0 | Offset in pixels from the position | | zIndex | number | string | var(--adhesive-z-index, 1) | Z-index for the fixed element | | enabled | boolean | true | Whether to enable sticky behavior | | outerClassName | string | 'adhesive__outer' | Class for the outer wrapper | | innerClassName | string | 'adhesive__inner' | Class for the inner wrapper | | initialClassName | string | 'adhesive--initial' | Class when element is in its initial state | | fixedClassName | string | 'adhesive--fixed' | Class when element is sticky | | relativeClassName | string | 'adhesive--relative' | Class when element reaches its boundary |

Usage:

<!-- Basic usage -->
<div {@attach adhesive()}>Content</div>

<!-- With options -->
<div {@attach adhesive({ position: "bottom", offset: 30 })}>Content</div>

<!-- With reactive options -->
<div {@attach adhesive({
  position,
  enabled,
  offset: 20,
  zIndex: 999
  })}>Content</div>