The list view component allows us to display the list view in a custom component. The following example shows the code for the list view component, using a design file to make it generic enough to adopt for any object and any list view:
<aura:component implements="flexipage:availableForRecordHome,flexipage:availableForAllPageTypes">
<aura:attribute name="ObjectName" type="String" default="Account"/>
<aura:attribute name="ListViewName" type="String" default="My_Accounts"/>
<Lightning:listView aura:id="listViewAccounts"
objectApiName="{!v.ObjectName}"
listName="{!v.ListViewName}"
rows="15"
showActionBar="false"
enableInlineEdit="true"
showRowLevelActions="false"/>
</aura:component>
The design file for the preceding component is as follows:
<design:component >
<design:attribute name="ObjectName" label="Object Name" description="Enter Object Name" />
<design:attribute name="ListViewName" label="ListView Name" description="Enter Name of the List View" />
</design:component>
The following screenshot shows how one can configure this component, by providing the object name and the list view name. Note that you will need the API name of the list view:
To learn more about considerations and supported features, explore the documents at https://developer.Salesforce.com/docs/component-library?page=Lightning:listView.