Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Use Images in an LWC Offline-Enabled Component

Lightning Web Components supports multiple ways of referencing graphics assets in a component. Not all of these methods work when the component runs offline. LWC Offline supports several methods of referencing images in your offline-ready Lightning web components.

The standard methods for referencing images (and other binary assets) in an LWC are:

  • Images uploaded as Files, using the VersionDataUrl field of the latest ContentVersion related to a particular ContentDocument record.
  • Content Assets, using the @salesforce/contentAssetUrl module.
  • Static Resources, using the @salesforce/resourceUrl module.

For LWCs with images intended to be used offline, we recommend the first two options. Static resources support offline images, but with limitations.

Support for offline images requires that both your Salesforce org and your mobile app are updated to the Summer ’23 release (API 58.0) or later.

Note