Image

A picture in a box of a set size or ratio, with a placeholder and a fallback.
Stable
Web
iOS
Android
@advui/core
Source

Basic

Sunlight over a valley of green hills

Installation

pnpm
pnpm add @advui/core
npm
npm install @advui/core

Usage

import { Image } from '@advui/core'

<Image src={photo.url} alt="A desert road between red rock canyons" ratio={16 / 9} borderRadius="lg" />

Examples

Cover and contain

A lake below forested mountains
cover
A lake below forested mountains
contain

Fallback

A missing file shows the default icon, or your own content.
Clinic entrance
Team photo

API reference

Image

Also takes View style props for the box (`width`, `height`, `borderRadius`…).
PropTypeDefaultDescription
src requiredstring | number—URL, or the result of `require()` for a bundled image on native.
alt requiredstring—What the image shows. `""` for decoration.
rationumber—Width divided by height. Without it, give the image a `height`.
fit'cover' | 'contain' | 'fill' | 'none' | 'scale-down''cover'How the picture fills the box (`object-fit` / `resizeMode`).
fallbackReactNodeimage iconShown when the image fails to load.
loading'lazy' | 'eager'—`lazy` waits until the image nears the viewport.Web only.
onLoad() => void—The image loaded.
onError() => void—The image failed to load.

Accessibility

  • alt is required. It names the image (img role) on every platform; pass alt="" when the image is decoration or its content is already in nearby text, and it is hidden from screen readers.
  • When the image fails, the fallback keeps the img role and the alt name, so the page reads the same.
  • The placeholder and default fallback icon are decorative.

Responsive behavior

With ratio, the height follows the width, so width="100%" scales with the layout. Without it, set both width and height.

Platform notes

Web
Renders an <img> with object-fit. A load or error that happened before hydration is read from the element once mounted.
iOS
Uses React Native’s Image; fit maps to resizeMode. Remote images need a size from the box (ratio or height).
Android
Same as iOS. Use HTTPS URLs.
Since v0.6.0Last updated Nov 2, 2026Edit this page on GitHub