0

I am trying to create a dropdown in the property panel of a webpart with SPFx and I found this tutorial: Use cascading dropdowns in web part properties

The problem with the sample is that is is using static data and I would like to know how to fetch the list names dynamically.

How can I do that? Best regards Americo

Americo Perez
  • 95
  • 1
  • 4
  • 17

1 Answers1

1

Use pnpjs library so you could get the lists easily.

sp.web.lists.get().then((items:any[])=>{
      console.log(items.length);
      //to do, bind to dropdown
    })

enter image description here

Lee
  • 5,305
  • 1
  • 6
  • 12