To display images, use the HTML <img> element. Include an image in your component by uploading it as a static resource or content asset.To display an icon, use the lightning:icon component, which gives you access to Salesforce Lightning Design System icons or your own custom icon. To display an avatar, use lightning:avatar.Consider lightning:buttonIcon or lightning:buttonIconStateful to display an actionable image such as a Like or Follow image.
Follow these accessibility guidelines when using images and icons in your component.
Informational Images and Icons
Informational images and icons can provide information that’s not available in the text, such as an image that represents an approved step. Include alternative text for images and icons to help users without access to the images and icons. Use the alt attribute with the <img> element and alternativeText attribute with the base components.
Decorative images are images that can be removed without affecting the logic or content of the page. Assistive text is optional for decorative images.
For example, placing an add icon or checkmark icon next to a text label reinforces the text’s meaning but adds no new information. Consider this Follow button with an add icon next to it. When clicked, the button label changes to “Following” and its icon updates to a checkmark. The icons don’t require assistive text.