Automatically populate my SPFx web part's property field with all choices from a choice field

Valued Contributor

I have a SPFx web part with one property named Department:-

  protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
    return {
      pages: [
        {
          header: {
            description: strings.PropertyPaneDescription
          },
          groups: [
            {
              groupName: strings.BasicGroupName,
              groupFields: [
                PropertyPaneTextField('department', {
                  label: 'Department'
                })
              ]
            }
          ]
        }
      ]
    };
  }

and it is a free text. so how i can make this property field Drop-down and populate its choices from a field named Department inside a list named Contacts?

Thanks

0 Replies