Socket
Book a DemoInstallSign in
Socket

svelte-image-viewer

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-image-viewer

A couple of simple components for displaying content with pan and zoom capabilities.

latest
Source
npmnpm
Version
6.0.0
Version published
Weekly downloads
136
-36.45%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-image-viewer

A couple of simple components for displaying content with pan and zoom capabilities.

Features

  • Pan and zoom capabilities
  • Works with any HTML element
  • Supports mouse and touchscreen interactions

Demo

Live

https://svelte-image-viewer.vercel.app/

Desktop

https://github.com/user-attachments/assets/8f41776c-b718-4fd2-8afe-942e54db5d62

Mobile

https://github.com/user-attachments/assets/43e45ee0-a282-4204-a08b-088e40edcd96

Installation

npm

npm install svelte-image-viewer

pnpm

pnpm add svelte-image-viewer

bun

bun add svelte-image-viewer

Getting Started

ImageViewer component

The ImageViewer component is a simple image viewer that displays an image with pan and zoom capabilities.

<script>
  import { ImageViewer } from "svelte-image-viewer";
</script>

<div
  style="position: relative; height: 512px; user-select: none; border: 1px solid white;"
>
  <ImageViewer src="https://picsum.photos/256" />
</div>

Viewer component

The Viewer component displays its children inside a container with pan and zoom capabilities.

<script>
  import { Viewer } from "svelte-image-viewer";
</script>

<div
  style="position: relative; height: 512px; user-select: none; border: 1px solid white;"
>
  <Viewer>
    <img src="https://picsum.photos/256" alt="" />
  </Viewer>
</div>

These components utilize Svelte's Attachments, which were introduced in Svelte 5.29.

If you're using an older version of Svelte (prior to 5.29), import from svelte-image-viewer/legacy to access the legacy versions that rely on Actions.

Support

If you find this project useful, consider supporting it by buying me a coffee:

ko-fi

Your support is appreciated. Thank you!

Keywords

svelte

FAQs

Package last updated on 12 Oct 2025

Did you know?

Socket

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.

Install

Related posts