Skip to content

Commit f174714

Browse files
authored
feat: add ability to disable suggestions on people-picker (#3048)
1 parent c572c01 commit f174714

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/mgt-components/src/components/mgt-people-picker/mgt-people-picker.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,18 @@ export class MgtPeoplePicker extends MgtTemplatedTaskComponent {
428428
})
429429
public ariaLabel: string;
430430

431+
/**
432+
* Sets whether the people suggestions should apper on the suggestion list
433+
*
434+
* @type {boolean}
435+
* @memberof MgtPerson
436+
*/
437+
@property({
438+
attribute: 'disable-suggestions',
439+
type: Boolean
440+
})
441+
public disableSuggestions = false;
442+
431443
/**
432444
* Get the scopes required for people picker
433445
*
@@ -928,6 +940,10 @@ export class MgtPeoplePicker extends MgtTemplatedTaskComponent {
928940
const graph = provider.graph.forComponent(this);
929941

930942
if (!input.length) {
943+
if (this.disableSuggestions) {
944+
this._foundPeople = [];
945+
return;
946+
}
931947
if (this.defaultPeople) {
932948
people = this.defaultPeople;
933949
} else {

stories/components/peoplePicker/peoplePicker.properties.stories.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ closeModal.addEventListener('click', () => {
6969
</script>
7070
`;
7171

72+
export const disableSuggestions = () => html`
73+
<mgt-people-picker disable-suggestions></mgt-people-picker>
74+
`;
75+
7276
export const dynamicGroupId = () => html`
7377
<mgt-people-picker id="picker"></mgt-people-picker>
7478
<div>

0 commit comments

Comments
 (0)