Skip to content

Commit 0f2de16

Browse files
author
Octavie van Haaften
committed
Implemented property Disabled for PeoplePicker Control. Updated Documentation.
1 parent 23af35a commit 0f2de16

File tree

6 files changed

+20
-1
lines changed

6 files changed

+20
-1
lines changed

docs/documentation/docs/controls/PeoplePicker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { PeoplePicker } from "@pnp/spfx-controls-react/lib/PeoplePicker";
3434
groupName={"Team Site Owners"} // Leave this blank in case you want to filter from all users
3535
showtooltip={true}
3636
isRequired={true}
37+
disabled={true}
3738
selectedItems={this._getPeoplePickerItems} />
3839
```
3940

@@ -56,6 +57,7 @@ The People picker control can be configured with the following properties:
5657
| groupName | string | no | group from which users are fetched. Leave it blank if need to filter all users |
5758
| personSelectionLimit | number | no | Defines the limit of people that can be selected in the control|
5859
| isRequired | boolean | no | Set if the control is required or not |
60+
| disabled | boolean | no | Set if the control is disabled or not |
5961
| errorMessage | string | no | Specify the error message to display |
6062
| errorMessageclassName | string | no | applies custom styling to the error message section|
6163
| showtooltip | boolean | no | Defines if need a tooltip or not |

docs/documentation/docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ The following controls are currently available:
3636
- [ListView](./controls/ListView) (List view control)
3737
- [Placeholder](./controls/Placeholder) (Control that can be used to show an initial placeholder if the web part has to be configured)
3838
- [SiteBreadcrumb](./controls/SiteBreadcrumb) (Breadcrumb control)
39-
- [SiteBreadcrumb](./controls/TaxonomyPicker) (Taxonomy Picker)
39+
- [TaxonomyPicker](./controls/TaxonomyPicker) (Taxonomy Picker)
40+
- [PeoplePicker](./controls/PeoplePicker) (People Picker)
4041
- [WebPartTitle](./controls/WebPartTitle) (Customizable web part title control)
4142
- [IFrameDialog](./controls/IFrameDialog) (renders a Dialog with an iframe as a content)
4243

docs/documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pages:
1111
- WebPartTitle: 'controls/WebPartTitle.md'
1212
- SecurityTrimmedControl: 'controls/SecurityTrimmedControl.md'
1313
- TaxonomyPicker: 'controls/TaxonomyPicker.md'
14+
- PeoplePicker: 'controls/PeoplePicker.md'
1415
- IFrameDialog: 'controls/IFrameDialog.md'
1516
- 'Field Controls':
1617
- 'Getting started': 'controls/fields/main.md'

src/controls/peoplepicker/IPeoplePicker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ export interface IPeoplePickerProps {
1414
* Text of the Control
1515
*/
1616
titleText: string;
17+
/**
18+
* Whether the control is enabled or not
19+
*/
20+
disabled?: boolean;
1721
/**
1822
* Name of SharePoint Group
1923
*/

src/controls/peoplepicker/PeoplePickerComponent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export class PeoplePicker extends React.Component<IPeoplePickerProps, IPeoplePic
267267
'aria-label': 'People Picker'
268268
}}
269269
itemLimit={this.props.personSelectionLimit || 1}
270+
disabled={this.props.disabled}
270271
onChange={this._onPersonItemsChange} />
271272
</div>
272273
);

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,16 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
309309
showtooltip={true}
310310
isRequired={true}
311311
selectedItems={this._getPeoplePickerItems} />
312+
313+
<PeoplePicker
314+
context={this.props.context}
315+
titleText="People Picker (disabled)"
316+
// personSelectionLimit={3}
317+
// groupName={"Team Site Owners"}
318+
disabled={true}
319+
showtooltip={true}
320+
isRequired={true}
321+
selectedItems={this._getPeoplePickerItems} />
312322
</div>
313323
);
314324
}

0 commit comments

Comments
 (0)