Skip to content

Commit ab37e4d

Browse files
committed
Documentation updates for the listpicker
1 parent b1e96e1 commit ab37e4d

File tree

6 files changed

+73
-1
lines changed

6 files changed

+73
-1
lines changed
20.9 KB
Loading
39.9 KB
Loading
42.2 KB
Loading
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# ListPicker control
2+
3+
This control allows you to select one or multiple available lists/libraries of the current site.
4+
5+
Here is an example of the control:
6+
7+
![ListPicker initial](../assets/ListPicker-initial.png)
8+
9+
`ListPicker` single selection mode:
10+
11+
![ListPicker single selection](../assets/ListPicker-single.png)
12+
13+
`ListPicker` multi-selection mode
14+
15+
![ListPicker multi selection](../assets/ListPicker-multi.png)
16+
17+
## How to use this control in your solutions
18+
19+
- Check that you installed the `@pnp/spfx-controls-react` dependency. Check out the [getting started](../#getting-started) page for more information about installing the dependency.
20+
- Import the control into your component:
21+
22+
```TypeScript
23+
import { ListPicker } from "@pnp/spfx-controls-react/lib/ListPicker";
24+
```
25+
26+
- Use the `ListPicker` control in your code as follows:
27+
28+
```TypeScript
29+
<ListPicker context={this.props.context}
30+
label="Select your list(s)"
31+
placeHolder="Select your list(s)"
32+
baseTemplate={100}
33+
includeHidden={false}
34+
multiSelect={false}
35+
onSelectionChanged={this.onListPickerChange} />
36+
```
37+
38+
- The `onSelectionChanged` change event returns the list(s) and can be implemented as follows:
39+
40+
```TypeScript
41+
private onListPickerChange (lists: string | string[]) {
42+
console.log("Lists:", lists);
43+
}
44+
```
45+
46+
## Implementation
47+
48+
The `ListPicker` control can be configured with the following properties:
49+
50+
| Property | Type | Required | Description |
51+
| ---- | ---- | ---- | ---- |
52+
| context | WebPartContext OR ApplicationCustomizerContext | yes | The context object of the SPFx loaded webpart or customizer. |
53+
| className | string | no | If provided, additional class name to provide on the dropdown element. |
54+
| disabled | boolean | no | Whether or not the control is disabled. |
55+
| baseTemplate | number | no | The SharePoint BaseTemplate ID to filter the list options by. |
56+
| includeHidden | boolean | no | Whether or not to include hidden lists. Default is `true`. |
57+
| orderBy | LibsOrderBy | no | How to order the lists retrieved from SharePoint. |
58+
| selectedList | string OR string[] | no | Keys of the selected item(s). If you provide this, you must maintain selection state by observing onSelectionChanged events and passing a new value in when changed. |
59+
| multiSelect | boolean | no | Optional mode indicates if multi-choice selections is allowed. Default to `false`. |
60+
| label | string | no | Label to use for the control. |
61+
| placeholder | string | no | Placeholder label to show in the dropdown. |
62+
| onSelectionChanged | (newValue: string OR string[]): void | no | Callback function when the selected option changes. |
63+
64+
Enum `LibsOrderBy`
65+
66+
| Value |
67+
| ---- |
68+
| Id |
69+
| Title |
70+
71+
![](https://telemetry.sharepointpnp.com/sp-dev-fx-controls-react/wiki/controls/ListPicker)

docs/documentation/docs/controls/TaxonomyPicker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Taxonomy Picker
22

3-
This control Allows you to select one or more Terms from a TermSet via its name or TermSet ID. You can also configure the control to select the child terms from a specific term in the TermSet by setting the AnchorId.
3+
This control allows you to select one or more Terms from a TermSet via its name or TermSet ID. You can also configure the control to select the child terms from a specific term in the TermSet by setting the AnchorId.
44

55
!!! note "Disclaimer"
66
This control makes use of the `ProcessQuery` API end-points to retrieve the managed metadata information. This will get changed once the APIs for managing managed metadata will become available.

docs/documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pages:
33
- Home: 'index.md'
44
- Controls:
55
- FileTypeIcon: 'controls/FileTypeIcon.md'
6+
- ListPicker: 'controls/ListPicker.md'
67
- ListView: 'controls/ListView.md'
78
- "ListView: add a contextual menu": 'controls/ListView.ContextualMenu.md'
89
- Placeholder: 'controls/Placeholder.md'

0 commit comments

Comments
 (0)