Media
Image
An image that can open in a viewer over the page, with rotate and zoom.
WAI-ARIA tested
Import
main.ts
import { Image } from '@vitral/vue';Basic
Preview
API
Read from packages/vue/src/components/Image/types.ts, so it says what the component actually accepts.
Props
| Name | Type | Description |
|---|---|---|
| src | string | — |
| alt | string | The image's text alternative. It also names the preview. |
| width | string | number | — |
| height | string | number | — |
| preview | boolean | Open a viewer with zoom and rotation when the image is pressed. |
| previewSrc | string | A larger image for the viewer. Defaults to `src`. |
| zoomStep | number | How much each zoom step changes the scale. Defaults to 0.25. |
| minZoom | number | Defaults to 0.5. |
| maxZoom | number | Defaults to 3. |
Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.
Emits
| Event | Payload | Description |
|---|---|---|
| show | — | — |
| hide | — | — |
| error | event: Event | — |
Slots
| Name | Slot props | Description |
|---|---|---|
| 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. |