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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@benbjurstrom/alpinejs-zoomable

v0.5.0

Published

Fullscreen image viewer (lightbox) for Alpine.js.

Downloads

319

Readme

zoomable

@benbjurstrom/alpinejs-zoomable

A fullscreen image viewer (lightbox) for Alpine.js, which offers modern accessibility features.

Installation

Via NPM

npm install @benbjurstrom/alpinejs-zoomable

Then initialize it inside your bundle:

import Alpine from 'alpinejs'
import Zoomable from '@benbjurstrom/alpinejs-zoomable'

// Attach the plugin
Alpine.plugin(Zoomable)

Alpine.start()

Via CDN

Add the following script tag BEFORE your Alpine.js core script:

<!-- Zoomable Plugin (example version) -->
<script defer src="https://unpkg.com/@benbjurstrom/[email protected]/dist/cdn.min.js"></script>

<!-- Alpine Core -->
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>

Usage

  1. Ensure you have an Alpine component scope somewhere in your DOM (e.g., a parent element with x-data).
  2. Add the x-zoomable directive to any element that you wish to enlarge on click.

Example:

<div x-data>
  <img x-zoomable src="example.jpg" alt="A scenic vista" />
</div>

When the image is clicked, a fullscreen view will open, allowing zooming and dragging. Pressing the Escape key, clicking outside the image, or pressing the close button will exit the fullscreen view.

Custom CSS

To allow for maxiumum customization this plugin does not include any styles. Below is an example CSS snippet you can include in your project to ensure a pleasant fullscreen experience. Feel free to customize as needed:

<style>
    img[x-zoomable]:hover {
        cursor: zoom-in;
    }

    .zoomable-fullscreen-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(255,255,255, 0.9);
        display: none;
        z-index: 998;
        cursor: zoom-out;
        overflow: hidden;
        touch-action: none;
    }

    .zoomable-fullscreen-image {
        position: absolute;
        max-height: none;
        max-width: none;
        cursor: grab;
        transition: transform 0.2s ease-out;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }

    .zoomable-fullscreen-image.dragging {
        cursor: grabbing;
        transition: none;
    }

    .zoomable-controls-panel {
        position: fixed;
        top: 20px;
        right: 20px;
        display: flex;
        gap: 10px;
        z-index: 999;
    }

    .zoomable-control-button {
        background: #a1a1aa;
        border: none;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.2s;
    }

    .zoomable-control-button > svg {
        width: 20px;
        height: 20px;
    }

    .zoomable-control-button:hover,
    .zoomable-control-button:focus {
        background: #71717a;
        outline: none;
    }

    @media (max-width: 768px) {
        .zoomable-controls-panel {
            top: 10px;
            right: 10px;
        }

        .zoomable-control-button {
            width: 44px;
            height: 44px;
            -webkit-tap-highlight-color: transparent; /* Prevents gray flash on iOS */
            touch-action: manipulation; /* Optimize for touch */
        }
    }

    .zoomable-loading-indicator {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #737373;
        font-size: 1rem;
    }

    .zoomable-spinner {
        width: 40px;
        height: 40px;
        border: 4px solid rgba(255, 255, 255, 0.3);
        border-top: 4px solid #737373;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 10px;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    .zoomable-loading-indicator[hidden] {
        display: none;
    }
</style>

Add the above CSS to your or your app.css file.