1

I'm wondering how can i display my attachment and its miniature in front of the title in lightning component ? is there a component that does the job ?

Here is an example : enter image description here Thanks in advance.

2
  • Could you clarify when you say miniature, if you are referring to see a preview of the file in a lightning component?
    – Jayant Das
    Commented Mar 29, 2019 at 16:12
  • It's like what is shown in the picture , like an avatar but its displays a preview of the attachment.
    – Sara
    Commented Mar 29, 2019 at 16:14

1 Answer 1

3

You can use lightning:fileCard here which does exactly what you want, i.e., displays a preview of a file.

A lightning:fileCard component displays a preview of a file.

...

The file type determines the icon used on the file preview and caption area.

The component is used as below, where the fileId value must be a valid 15 character ContentDocument ID.

<lightning:fileCard fileId="xxxx" description="Description"/>
4
  • Do you have any idea why its doesnt work it shows me no preview available ?
    – Sara
    Commented Mar 29, 2019 at 16:56
  • Which experience are you viewing the file in? You may like to check the documentation to see if that may be the reason
    – Jayant Das
    Commented Mar 29, 2019 at 16:59
  • I'm using it in opportunity object and the file is stored in attachments
    – Sara
    Commented Mar 29, 2019 at 17:01
  • 1
    Okay I think the component only supports ContentDocument
    – Jayant Das
    Commented Mar 29, 2019 at 17:11

You must log in to answer this question.

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