File Card

lightning:fileCard

Displays a preview of an uploaded file available in Salesforce CRM Content or Salesforce Files. For Aura components only.

For Use In

Lightning Experience, Experience Builder Sites, Salesforce Mobile App

A lightning:fileCard component displays a preview of a file. On desktops, clicking the file preview opens the SVG file preview player, enabling you to preview images, documents, and other files in the browser. The file preview player provides quick access to file actions, such as upload, delete, download, and share. On mobile devices, clicking the file preview downloads the file. Descriptions are visible in the file preview unless the hideDescription attribute is true. The file type determines the icon used on the file preview and caption area.

This component implements styling from files in the Lightning Design System.

Here’s an example of a file preview. The fileId value must be a valid 15 character ContentDocument ID.

1<aura:component>
2  <lightning:fileCard
3    fileId="069XXXXXXXXXXXX"
4    description="Sample Description"
5  />
6</aura:component>

Usage Considerations 

Opening the file preview player is supported in Lightning Experience, the Salesforce mobile app, and Experience Builder sites.

Attributes 

NameDescriptionTypeDefaultRequired
bodyThe body of the component. In markup, this is everything in the body of the tag.Aura.Component[]
descriptionThe description of the file, by default it is set to the filenameString
fileIdThe Salesforce File ID (ContentDocument).String
hideDescriptionHides the file description in the caption if enabledBooleanfalse