The Image
component allows you to display images from various sources, such as system symbols, network URLs, local files, or UIImage
objects. It supports dynamic image sources that change based on light or dark color schemes. Additionally, several view modifiers are available to customize the behavior and appearance of the Image
component.
ImageResizable
Defines how the image should be resized:
boolean
:
true
: Enables default resizing.false
: Disables resizing.object
:
capInsets
(optional): EdgeInsets
Defines insets for image stretching to control which parts of the image stretch and which remain fixed.
resizingMode
(optional): ImageResizingMode
Specifies the resizing mode, such as scaling or tiling.
ImageScale
Specifies relative image sizes available within the view:
'large'
: Renders the image at a large size.'medium'
: Renders the image at a medium size.'small'
: Renders the image at a small size.DynamicImageSource<T>
Defines a dynamic source that changes based on the system color scheme:
Used for adapting the image resource for light/dark modes. Supported in:
imageUrl
(network images)filePath
(local file images)image
(UIImage
objects)SystemImageProps
systemName
(string, required)
The name of a system-provided symbol.
Refer to the SF Symbols library or use the SF Symbols Browser app to browse available symbol names.
variableValue
(number, optional)
A value between 0.0
and 1.0
for customizing the appearance of a variable symbol.
(Has no effect for symbols that do not support variable values.)
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
NetworkImageProps
imageUrl
(string | DynamicImageSource, required)
The URL of the image to load. Supports dynamic sources via DynamicImageSource
.
placeholder
(VirtualNode, optional)
A view displayed while the image is loading.
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
FileImageProps
filePath
(string | DynamicImageSource, required)
The path to the local image file. Supports dynamic sources via DynamicImageSource
.
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
UIImageProps
image
(UIImage | DynamicImageSource, required)
A UIImage
object to display. Supports dynamic sources via DynamicImageSource
.
resizable
(ImageResizable, optional)
Configures how the image is resized to fit its allocated space.
Modifiers applicable to the Image
component and other views:
scaleToFit
(boolean, optional)
Scales the view to fit its parent container.
scaleToFill
(boolean, optional)
Scales the view to fill its parent container.
aspectRatio
(object, optional)
Configures the view's aspect ratio:
value
(number or null, optional): The width-to-height ratio. If null
, maintains the current aspect ratio.contentMode
(ContentMode, required): Determines whether the content fits or fills its parent.imageScale
(ImageScale, optional)
Adjusts the size of images within the view. Options: 'large'
, 'medium'
, 'small'
.
foregroundStyle
(ShapeStyle or DynamicShapeStyle or object, optional)
Configures the view's foreground elements:
primary
: Style for the primary foreground elements.secondary
: Style for secondary elements.tertiary
(optional): Style for tertiary elements.DynamicImageSource
to adapt images for light/dark mode with minimal logic.scaleToFit
, scaleToFill
, and aspectRatio
to achieve precise layout configurations.foregroundStyle
property for detailed styling of icons or symbols.