Tally UI
Primitives

Image

A cross-platform image component with consistent content-fit behavior.

Import

import { Image } from '@tallyui/primitives';

Usage

<Image.Root
  source={{ uri: 'https://example.com/photo.jpg' }}
  alt="Product photo"
  contentFit="cover"
  style={{ width: 200, height: 200 }}
/>

Components

Image.Root

Renders an image with a unified contentFit API that normalizes across platforms.

PropTypeDefaultDescription
sourceImageSourcePropTyperequiredThe image source (URI or require)
altstringAccessible description of the image
placeholderImageSourcePropTypeLow-res placeholder shown while loading
contentFit'cover' | 'contain' | 'fill' | 'none' | 'scale-down''cover'How the image fills its container

Plus all React Native ImageProps (except resizeMode, which is replaced by contentFit).

Content fit values

ValueDescription
coverScales to fill the container, cropping if necessary
containScales to fit entirely within the container
fillStretches to fill the container exactly
noneNo scaling, displayed at original size
scale-downLike contain, but never scales up beyond original size

Accessibility

  • The alt prop sets accessibilityLabel on native and alt on web
  • Decorative images should use alt=""

On this page