Vitral 0.2.18
Media

Image

An image that can open in a viewer over the page, with rotate and zoom.

Import

main.ts
import { Image } from '@vitral/vue';

Basic

A lake between pine-covered hills
<script setup lang="ts">import { Image } from '@vitral/vue';</script> <template>    <Image src="https://picsum.photos/id/1043/320/200" alt="A lake between pine-covered hills" width="320" /></template>

Preview

<script setup lang="ts">import { Image } from '@vitral/vue';</script> <template>    <Image src="https://picsum.photos/id/1036/320/200" preview-src="https://picsum.photos/id/1036/1280/800" alt="Snowy mountains at dusk" width="320" preview /></template>

API

Read from packages/vue/src/components/Image/types.ts, so it says what the component actually accepts.

Props

NameTypeDescription
src string—
alt stringThe image's text alternative. It also names the preview.
width string | number—
height string | number—
preview booleanOpen a viewer with zoom and rotation when the image is pressed.
previewSrc stringA larger image for the viewer. Defaults to `src`.
zoomStep numberHow much each zoom step changes the scale. Defaults to 0.25.
minZoom numberDefaults to 0.5.
maxZoom numberDefaults to 3.

Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.

Emits

EventPayloadDescription
show ——
hide ——
error event: Event—

Slots

NameSlot propsDescription
image (props: { errorCallback: (event: Event) => void })Replaces the image, e.g. with a <picture>.
preview (props: { style: Record<string, string>; previewCallback: () => void })Replaces the image in the viewer.
indicator —Replaces the hover indicator.