---
title: "Quick start"
description: "The three ways to open the viewer, in five minutes."
canonical_url: "https://kukson777.github.io/nuxt-image-viewer/docs/getting-started/quick-start"
---
# Quick start

> The three ways to open the viewer, in five minutes.

## A gallery

Put images in a container with `data-image-viewer-group`: the viewer scrolls through the images of that group only. Without a group it scrolls through every marked image of the page.

```vue
<template>
  <div class="gallery" data-image-viewer-group>
    <ZoomImage
      v-for="photo in photos"
      :key="photo.src"
      v-bind="photo"
    />
  </div>
</template>

<script setup lang="ts">
const photos = [
  { src: '/photos/dawn.jpg', width: 2400, height: 1600, caption: 'Alpine dawn' },
  { src: '/photos/dusk.jpg', width: 1600, height: 2400, caption: 'Dusk' },
]
</script>
```

<demo-gallery>



</demo-gallery>

<note>

`width` and `height` are the natural size of the **full** image, not the size on the page. The viewer fits and zooms the image by them — up to its natural size, but at least 2×.

</note>

## Images you already have

HTML from a CMS or Markdown doesn't need the component — tag the `<img>`:

```html
<img
  src="/photos/dawn-small.jpg"
  alt="Dawn"
  tabindex="0"
  data-image-viewer
  data-image-viewer-src="/photos/dawn.jpg"
  data-image-viewer-width="2400"
  data-image-viewer-height="1600"
>
```

## From code

```ts
const viewer = useImageViewer()

viewer.open([
  { src: '/photos/dawn.jpg', width: 2400, height: 1600 },
  { src: '/photos/dusk.jpg' }, // no size: measured before opening
])
```

<open-from-code-demo>



</open-from-code-demo>

## Next

- Restyle it on the [Theming](https://kukson777.github.io/nuxt-image-viewer/docs/customization/theming) page with the live builder.
- Change behaviour with [Options](https://kukson777.github.io/nuxt-image-viewer/docs/customization/options).


## Sitemap

See the full [sitemap](https://kukson777.github.io/nuxt-image-viewer/sitemap.md) for all pages.
