New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vue3-compare-image

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

vue3-compare-image

A Vue 3 component to compare and slide between two images, supports vertical and horizontal modes, and Keyboard for accessibility.

latest
Source
npmnpm
Version
1.2.6
Version published
Weekly downloads
528
-21.43%
Maintainers
1
Weekly downloads
 
Created
Source

vue3-compare-image

CI npm version npm downloads Coverage License

Vue 3 component for before/after image comparison with drag, hover mode, keyboard navigation, and vertical or horizontal layouts.

This project is a Vue 3-focused fork of vue-compare-image, with behavior parity improvements inspired by react-compare-image.

Features

  • Vue 3 + TypeScript
  • Horizontal and vertical comparison
  • Keyboard accessibility (ArrowLeft, ArrowRight, ArrowUp, ArrowDown)
  • Optional hover-driven interaction
  • Custom handle and labels
  • CI-gated lint, typecheck, test, build, docs build

Documentation

Installation

pnpm add vue3-compare-image
# or
npm i vue3-compare-image
# or
yarn add vue3-compare-image

Usage

Global registration

import { createApp } from 'vue'
import VueCompareImage from 'vue3-compare-image'
import App from './App.vue'

createApp(App).use(VueCompareImage).mount('#app')

Local registration

<script setup lang="ts">
import { VueCompareImage } from 'vue3-compare-image'
</script>

<template>
  <VueCompareImage
    left-image="/before.jpg"
    right-image="/after.jpg"
  />
</template>

Type reference (optional)

/// <reference types="vue3-compare-image/client" />

Props

PropTypeDefaultDescription
leftImage (required)string-Left image URL
rightImage (required)string-Right image URL
verticalbooleanfalseUse vertical comparison mode
keyboardbooleanfalseEnable keyboard navigation
keyboardStepnumber0.01Slider step per keyboard press
aspectRatio'taller' | 'wider''wider'Aspect ratio strategy
handlestring | number | booleanundefinedCustom handle markup
handleSizenumber40Handle size in px
hoverbooleanfalseMove slider with hover/mousemove
slideOnClickbooleantrueMove slider on click/tap
leftImageAltstring''Left image alt text
rightImageAltstring''Right image alt text
leftImageCssRecord<string, string>{}Inline styles for left image
rightImageCssRecord<string, string>{}Inline styles for right image
leftImageLabelstringundefinedLeft image label
rightImageLabelstringundefinedRight image label
skeletonstring | number | booleanundefinedLoading placeholder HTML
sliderLineColorstring'#ffffff'Slider line color
sliderLineWidthnumber2Slider line width in px
sliderPositionPercentagenumber0.5Initial slider position from 0 to 1
onSliderPositionChange(position: number) => voidundefinedCallback on slider position updates

Events

  • slideStart(position: number)
  • slideEnd(position: number)
  • isSliding(state: boolean)

Development

pnpm install
pnpm dev

Quality gates

pnpm lint
pnpm typecheck
pnpm test:run
pnpm coverage
pnpm build
pnpm docs:build

Contributing

Please read CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md before contributing.

Keywords

vue-3-compare-image

FAQs

Package last updated on 07 Mar 2026

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