How to display image formula fields in lightning datatable ?

enter image description here


2 Answers 2


As author have stated, we can use this link to learn how to create custom type: https://salesforcecodex.com/2019/10/show-image-in-lightning-web-component-data-table/

Afterwards, in the HTML of your custom type, create a lightning-formatted-rich-text which takes the variable string as literal HTML - so it displays correctly:

    <div class="slds-p-top_x-small slds-p-left_x-small">
        <lightning-formatted-rich-text value={value} ></lightning-formatted-rich-text>

Thank you @zaitsman thats helpful.

And also found this example online


Thank you Dhanik Lal Sahni for the detailed example.

  • hi, how did you solve this? because, the link you sent is intented for urls, and what you have (and me too) is an html markup... how does that work? Aug 10, 2021 at 13:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .