---
title: "Types"
description: "Every public type, importable from the package."
canonical_url: "https://kukson777.github.io/nuxt-image-viewer/docs/api/types"
---
# Types

> Every public type, importable from the package.

```ts
import type {
  ImageViewerApi,
  ImageViewerButton,
  ImageViewerButtonIcon,
  ImageViewerControls,
  ImageViewerItem,
  ImageViewerOpenOptions,
  ImageViewerSlide,
  ImageViewerUi,
  ImageViewerLabels,
  ModuleOptions,
} from 'nuxt-image-viewer'
```

All of them carry JSDoc, so your editor — and your coding agent — shows the docs inline.

## ImageViewerItem

One image passed to `open()`. Only `src` is required.

```ts
interface ImageViewerItem {
  /** Full-size image shown in the viewer. */
  src: string
  /** Smaller copy already loaded on the page — shown at once while `src` loads. */
  thumb?: string
  /** Natural size of `src`. Without it the image is measured before opening. */
  width?: number
  height?: number
  alt?: string
  /** Text shown under the image. */
  caption?: string
  /** Element on the page the image opens from and closes back into. */
  element?: HTMLElement
}
```

## ImageViewerOpenOptions

Overrides of the global options for one `open()` call.

```ts
type ImageViewerOpenOptions = Partial<{
  zIndex: number
  bgOpacity: number
  loop: boolean
  spacing: number
  maxZoom: number
  closeOnVerticalDrag: boolean
  closeOnBackdropClick: boolean
  idleDelay: number
  idleHidesCaption: boolean
}> & {
  ui?: Partial<ImageViewerUi>
  labels?: Partial<ImageViewerLabels>
  /** Your own components in place of the arrows. */
  controls?: Partial<ImageViewerControls>
  /** Replace the buttons set with configure(). */
  buttons?: ImageViewerButton[]
}
```

## ImageViewerButton

A [custom button](https://kukson777.github.io/nuxt-image-viewer/docs/customization/custom-buttons) in the toolbar: an icon component, a text, or both. An icon-only button needs a `label`.

```ts
type ImageViewerButton = {
  /** Unique name. Also the class modifier: .image-viewer__button--{name} */
  name: string
  onClick: (context: { item: ImageViewerSlide, index: number, close: () => void }) => void
} & (
  | { icon: ImageViewerButtonIcon, text?: string, label: string }
  | { icon?: ImageViewerButtonIcon, text: string, label?: string }
)

/** A Nuxt Icon name, as in <UIcon name>, or any component. */
type ImageViewerButtonIcon = string | Component
```

## ImageViewerControls

Your [own arrows](https://kukson777.github.io/nuxt-image-viewer/docs/customization/custom-buttons#your-own-arrows) in place of the built-in ones — any components, they need no props: the viewer places them, scrolls on their click and names an icon-only button from the labels.

```ts
interface ImageViewerControls {
  prev: Component
  next: Component
}
```

## ImageViewerUi

```ts
interface ImageViewerUi {
  counter: boolean
  zoom: boolean
  fullscreen: boolean
  close: boolean
  arrows: boolean
  caption: boolean
}
```

## ImageViewerLabels

```ts
interface ImageViewerLabels {
  dialog: string
  close: string
  zoomIn: string
  zoomOut: string
  fullscreen: string
  exitFullscreen: string
  prev: string
  next: string
}
```

## ImageViewerSlide

An item with everything resolved — what `useImageViewer().items` holds.

```ts
interface ImageViewerSlide {
  src: string
  thumb: string
  width: number
  height: number
  alt: string
  caption?: string
  element?: HTMLElement
}
```

## ImageViewerApi

What `useImageViewer()` returns — see [useImageViewer()](https://kukson777.github.io/nuxt-image-viewer/docs/api/use-image-viewer).

## ModuleOptions

The `imageViewer` key of `nuxt.config` — see [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.
