9

There is an Aura lightning:listView, but presently not a LWC lightning-list-view. For most Aura components there is an LWC equivalent. That allows the composting composing of LWCs inside other LWCs which is a great way to leverage what has already been built rather than having to start from scratch.

Why no LWC in this case?

2 Answers 2

10

While looks there is no component which is very similar to aura version there is api thats of BETA quality.

There is a lightning/uiListApi module to get List views data and metadata in LWC. Note that as of today it is under BETA.

There is also a sample code in the trailhead recipe repo

import { LightningElement, wire } from 'lwc';
import { getListUi } from 'lightning/uiListApi';

import CONTACT_OBJECT from '@salesforce/schema/Contact';
import NAME_FIELD from '@salesforce/schema/Contact.Name';

export default class WireListView extends LightningElement {
 @wire(getListUi, {
    objectApiName: CONTACT_OBJECT,
    listViewApiName: 'All_Recipes_Contacts',
    sortBy: NAME_FIELD,
    pageSize: 10
})
listView;

 get contacts() {
    return this.listView.data.records.records;
 }
}

You can combine this with the lightning-datatable to get one similar to the list view.

5
  • 1
    Thanks Mohith. No word on a lightning-list-view? Any idea why not?
    – Keith C
    Commented Apr 1, 2020 at 16:13
  • 1
    @keith No word on it but I will let you know once I hear something on it. Commented Apr 2, 2020 at 3:19
  • 5
    As a note, "lightning/uiListApi" is deprecated as of time of writing, and as per SF documentation, may cease to work in the future
    – Jwok
    Commented Jul 14, 2021 at 18:15
  • But there's the lightning/uiListsApi developer.salesforce.com/docs/component-library/documentation/… Commented Jul 12, 2022 at 13:56
  • A shameless plug. I use this - appexchange.salesforce.com/…. It has an LWC component but also enhances list views with a ton of other features.
    – Tom Ansley
    Commented Jul 17 at 16:18
-1

Looks like there is this now, putting this here to help other folks searching for the answer! https://developer.salesforce.com/docs/component-library/bundle/lightning:listView/documentation

2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
    – identigral
    Commented Dec 21, 2023 at 17:23
  • 1
    That is the Aura component; was looking for an LWC equivalent.
    – Keith C
    Commented Dec 22, 2023 at 9:05

You must log in to answer this question.

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