Plat-Dev-201 practice question 1 of 30

Which three steps allow a custom Scalable Vector Graphic (SVG) to be included in a Lightning web component? Choose 3 answers

Full set: 204 questions
Answer options
A: Import the static resource and provide a JavaScript property for it. Correct answer
B: Upload the SVG as a static resource. Correct answer
C: Reference the import in the HTML template. Correct answer
D: Import the SVG as a content asset file.
E: Reference the property in the HTML template.
Correct Answer:
A. Import the static resource and provide a JavaScript property for it.; B. Upload the SVG as a static resource.; C. Reference the import in the HTML template.
Explanation

Lightning Web Components use static resources for custom SVGs. First, upload the SVG as a static resource (B). In the component’s JavaScript, import it using the @salesforce/resourceUrl directive and expose it via a property (A). Finally, reference that imported variable in the HTML template—for example, —to render the image (C).

Why Incorrect

D. Content assets are for CMS and aren’t required for LWC static-resource usage.
E. The template refers directly to the imported variable; no additional property beyond that created in step A is needed, so it is redundant.

References

1. Lightning Web Components Dev Guide, “Use SVG Resources—Import a Static Resource,” Winter ’24 release, para. 1-3.

2. Lightning Web Components Dev Guide, “Static Resources in LWC,” Winter ’24, Example code block showing upload-import-reference workflow.

Scroll to Top