Image
A component for displaying bundled and remote images
How to use
The Image component can display images that you've uploaded to your Draftbit project's Assets which will be bundled with your app's files or you can give it a URL to a remote image. You can add one to your Screen from the component picker.
The currently supported formats are
png
,jpg
,jpeg
,bmp
,gif
,webp
, andsvg
.
Style Properties
Style properties allow you to customize the look and feel of the component. Combinations of styles applied to components can be saved as Stylesheets to easily reuse styles throughout your app. Styles can also be set dynamically using Variables. To learn more about all the different styling properties and how they work, take a look at Intro to Styling.
Component Specific Styles
Property | Description |
---|---|
Blur Radius | A number between On IOS, you will need to higher than |
Sizing
You adjust the size using the Width and Height props in the Styles Panel.
You may need to play around with a combination of the Width, Height, Resize Mode, and Content Position to get the desired effect.
Configuration Properties
Property | Description |
---|---|
Component Name | Set the name of the component. The name is reflected in the Components tree. Defaults to Image. |
Resize Mode | Determines how the image should be resized to fit its container. This property tells the image to fill the container in a variety of ways; such as "preserve that aspect ratio" or "stretch up and take up as much space as possible". It mirrors the CSS object-fit property.
|
Content Position | It is used together with Content Fit to specify how the image should be positioned with x/y coordinates inside its own container. An equivalent of the CSS object-position property. |
Transition Effect | Set how the image view should transition the contents when switching the image source. On Android, only |
Transition Duration | The duration of the Transition Effect in milliseconds |
Transition Timing | Specifies the speed curve of the Transition Effect and how intermediate values are calculated. |
Cache Policy | Determines whether to cache the image and where
|
Allow Downscaling | Whether the image should be downscaled to match the size of the view container. Turning off this functionality could negatively impact the application's performance, particularly when working with large assets. However, it would result in smoother image resizing, and end-users would always have access to the highest possible asset quality. Downscaling is never used when the Content Fit prop is set to |
Data Properties
Property | Description |
---|---|
Source Type | Select the type of source to use for the image
|
Source | Set the source to use for the image depending on which Source Type you selected. For For For |
Conditional Display
You can conditionally display a component based on a given condition. Learn more about conditionally displaying components in the Conditional Display doc.
Examples
Adding rounded corners to an image
To give an Image rounded corners, you can adjust the Image's Border Radius property in the Styles panel.
Adding components on top of an image
If you want to position other content on top of an image, you should instead use the Image Background component which acts like a View with a background image.
Updated 5 days ago