Vue NativeVue Native
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
Guide
Components
Composables
Navigation
  • iOS
  • Android
  • macOS
GitHub
  • Layout

    • VView
    • VScrollView
    • VSafeArea
    • VKeyboardAvoiding
  • Text & Input

    • VText
    • VInput
  • Interactive

    • VButton
    • VPressable
    • VSwitch
    • VSlider
    • VSegmentedControl
    • VCheckbox
    • VRadio
    • VDropdown
    • VRefreshControl
  • Media

    • VImage
    • VWebView
    • VVideo
  • Lists

    • VList
    • VFlatList
    • VSectionList
  • Feedback

    • VActivityIndicator
    • VProgressBar
    • VAlertDialog
    • VActionSheet
    • VModal
    • VErrorBoundary
  • Transition & State

    • VTransition & VTransitionGroup
    • KeepAlive
    • VSuspense
  • Navigation

    • VNavigationBar
    • VTabBar
  • System

    • VStatusBar
    • VPicker
  • macOS

    • VToolbar
    • VSplitView
    • VOutlineView

VImage

Displays images from remote URLs. Maps to UIImageView on iOS and ImageView (powered by Coil) on Android. Images are loaded asynchronously with built-in memory caching.

Usage

<VImage
  :source="{ uri: 'https://example.com/photo.jpg' }"
  resizeMode="cover"
  :style="{ width: 200, height: 150, borderRadius: 8 }"
/>

Props

PropTypeDefaultDescription
source{ uri: string }--Image source object with a uri field
resizeMode'cover' | 'contain' | 'stretch' | 'center''cover'How the image is scaled to fit its container
styleObject--Layout + appearance styles (width and height recommended)
testIDstring--Test identifier for end-to-end testing
accessibilityLabelstring--Accessible description of the image
accessibilityRolestring--The accessibility role (e.g. 'image')
accessibilityHintstring--Describes what happens when the user interacts with the element
accessibilityStateObject--Accessibility state object

Resize Modes

ModeDescription
coverScale to fill the container, cropping if needed (default)
containScale to fit within the container, preserving aspect ratio
stretchStretch to fill the exact dimensions of the container
centerCenter without scaling

Events

EventPayloadDescription
@load--Fired when the image finishes loading
@error{ message: string }Fired when the image fails to load

Example

<script setup>
import { ref } from 'vue'

const loaded = ref(false)
const error = ref('')

const onLoad = () => {
  loaded.value = true
}

const onError = (e) => {
  error.value = e.message
}
</script>

<template>
  <VView :style="styles.container">
    <VImage
      :source="{ uri: 'https://picsum.photos/400/300' }"
      resizeMode="cover"
      :style="styles.image"
      accessibilityLabel="Random landscape photo"
      @load="onLoad"
      @error="onError"
    />
    <VText v-if="loaded" :style="styles.caption">Image loaded</VText>
    <VText v-if="error" :style="styles.error">{{ error }}</VText>

    <VView :style="styles.row">
      <VImage
        :source="{ uri: 'https://picsum.photos/100/100' }"
        resizeMode="cover"
        :style="styles.avatar"
      />
      <VText :style="styles.name">Jane Doe</VText>
    </VView>
  </VView>
</template>

<script>
import { createStyleSheet } from '@thelacanians/vue-native-runtime'

const styles = createStyleSheet({
  container: {
    flex: 1,
    padding: 16,
  },
  image: {
    width: '100%',
    height: 200,
    borderRadius: 12,
  },
  caption: {
    marginTop: 8,
    color: '#34C759',
    fontSize: 14,
  },
  error: {
    marginTop: 8,
    color: '#FF3B30',
    fontSize: 14,
  },
  row: {
    flexDirection: 'row',
    alignItems: 'center',
    marginTop: 24,
  },
  avatar: {
    width: 48,
    height: 48,
    borderRadius: 24,
  },
  name: {
    marginLeft: 12,
    fontSize: 16,
    fontWeight: '600',
  },
})
</script>

Tips

Always set explicit width and height on VImage styles. Without dimensions the layout engine cannot reserve space before the image loads, which causes content jumps.

Edit this page
Last Updated: 2/28/26, 11:24 PM
Contributors: Abdul Hamid, Claude Opus 4.6
Next
VWebView