spfx-async-dropdown
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

spfx-async-dropdown

CI Status npm version

Asynchronous dropdown component for the SPFx property pane

Screenshot

Installation

npm install spfx-async-dropdown
import { PropertyPaneAsyncDropdown } from "spfx-async-dropdown"

Examples

Get lists that are in the root web using pnpjs

new PropertyPaneAsyncDropdown("list"{
    label: "List",
    onLoad: async () => {
        const lists = await sp.site.rootWeb.lists.select("Id""Title").get();
        return lists.map(list => {
            return {
                key: list.Id,
                text: list.Title
            }
        })
    },
    onPropertyChange: (property: string, newValue: any) => {
        const oldValue = get(this.properties, property);
        update(this.properties, property, () => newValue);
        this.onPropertyPaneFieldChanged(property, oldValue, newValue);
        this.render();
    },
    selectedKey: this.properties.list,
    required: true,
    tooltip: {
        content: "Testing Tooltip",
        iconName: "List"
    },
    placeholder: "Select an item...",
    description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua"
})

Props

Prop Type
label
(required)
string
onLoad
(required)
() => Promise<IDropdownOption[]>
onPropertyChange
(required)
(property: string, newValue: any) => void
selectedKey
(required)
string or number
disabled boolean
required boolean
tooltip IToolTip ({ content: string, iconName: string}). iconName is a Fabric icon
placeholder string
description string

Package Sidebar

Install

npm i spfx-async-dropdown

Weekly Downloads

8

Version

2.0.0

License

MIT

Unpacked Size

482 kB

Total Files

17

Last publish

Collaborators

  • clarktozer