Skip to main content

Image

Rocket 2.0

The Image component shows a picture from a URL, such as a product photo, a logo or an uploaded file. It shows a fallback when the image is missing or fails to load.

Properties​

Property
Description
Expected Value
Image URLURL of the image to show.Text. Default: https://images.unsplash.com/photo-1506744038136-46273834b3fb?w=800
Alt textDescription of the image read by screen readers. It is also the fallback text when Fallback name (initials) or text is empty.Text. Default: Mountain lake at sunrise
FitHow the image fills its box: Cover fills and crops, Contain shows the whole image, Fill stretches it.Cover (fill, crop), Contain (whole image), Fill (stretch). Default: Cover (fill, crop)
Aspect ratioShape of the image box. Auto fills the component's height.Auto (component height), 1:1 square, 4:3, 3:2, 16:9, 21:9, 3:4 portrait, 9:16 portrait. Default: Auto (component height)
CaptionText shown under the image.Text
FallbackWhat shows when there is no image or it fails to load: a Placeholder with text, an Icon, or Initials made from the fallback name.Placeholder, Icon, Initials. Default: Placeholder
Fallback name (initials) or textName to make initials from, or text for the placeholder, when the image can't be shown.Text
BorderDraws a border around the image.On or off. Default: Off
Zoom on click (lightbox)Opens the image full size in a lightbox when the user clicks it.On or off. Default: Off
Loading lookWhat the component shows while it is loading: a Spinner or a grey Skeleton placeholder.Spinner, Skeleton. Default: Spinner

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On clickTriggers when the user clicks the image.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set image URLShows the image at URL in place of the current one.components.image1.setImageURL("")
Clear imageRemoves the image, so the fallback shows.components.image1.clearImage()
Set visibilityShows the component when true, hides it when false.components.image1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.image1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.image1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
sourceURL of the image to show.{{components.image1.source}}
alternativeTextDescription of the image read by screen readers. It is also the fallback text when Fallback name (initials) or text is empty.{{components.image1.alternativeText}}
imageFitHow the image fills its box: Cover fills and crops, Contain shows the whole image, Fill stretches it.{{components.image1.imageFit}}
aspectRatioShape of the image box. Auto fills the component's height.{{components.image1.aspectRatio}}
captionText shown under the image.{{components.image1.caption}}
fallbackWhat shows when there is no image or it fails to load: a Placeholder with text, an Icon, or Initials made from the fallback name.{{components.image1.fallback}}
fallbackTextName to make initials from, or text for the placeholder, when the image can't be shown.{{components.image1.fallbackText}}
showBorderDraws a border around the image.{{components.image1.showBorder}}
zoomOnClickOpens the image full size in a lightbox when the user clicks it.{{components.image1.zoomOnClick}}
loadingIndicatorWhat the component shows while it is loading: a Spinner or a grey Skeleton placeholder.{{components.image1.loadingIndicator}}
hasErrortrue when there is no image URL or the image failed to load.{{components.image1.hasError}}
imageURLURL of the image the component is showing.{{components.image1.imageURL}}
isVisibleWhether the component is visible.{{components.image1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.image1.isLoading}}
isDisabledWhether the component is disabled.{{components.image1.isDisabled}}

Styles​

Style
Default
Image radius—
Border colorTheme: Default border
Background (letterbox and fallback)—
Fallback text and icon colorTheme: Placeholder text
Caption colorTheme: Placeholder text
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.