Getting Started
Installation
Add the module to your Nuxt app.
Install the module
Use the Nuxt CLI — it installs the package and adds it to modules:
Terminal
npx nuxt module add nuxt-image-viewer
Or install it with your package manager and add it yourself:
pnpm add nuxt-image-viewer
npm install nuxt-image-viewer
bun add nuxt-image-viewer
yarn add nuxt-image-viewer
nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-image-viewer'],
})
Mark an image
app.vue
<template>
<ZoomImage
src="/photos/dawn.jpg"
:width="2400"
:height="1600"
caption="Dawn over the ridges"
/>
</template>
That's it — click the image.
Requirements
- Nuxt
>=3.13, including Nuxt 4. - A browser with Pointer Events and the Web Animations API — every evergreen browser.
With Nuxt Image installed,
<ZoomImage> renders <NuxtImg>: the page gets an optimized copy and the viewer opens the full image. See ZoomImage.