Edit

People component in Microsoft Graph Toolkit

Caution

The Microsoft Graph Toolkit is deprecated. The retirement period begins September 1, 2025, with full retirement planned for August 28, 2026. Developers should migrate to using the Microsoft Graph SDKs or other supported Microsoft Graph tools for building web experiences. For more information, see the deprecation announcement.

You can use the mgt-people web component to display a group of people or contacts by using their photos or initials. By default, it displays the most frequent contacts for the signed-in user.

This component uses multiple mgt-person controls, but it can be bound to a set of people descriptors. If there are more people to display than the show-max value, a number is added to indicate the number of other contacts.

Example

The following example shows a group of people displayed using the mgt-people component. You can use the code editor to see how properties change the behavior of the component.

Properties

By default, the mgt-people component fetches events from the /me/people endpoint with the personType/class eq 'Person' filter to display frequently contacted users. You can use several properties to change this behavior.

Attribute Property Description
show-max showMax Indicates the maximum number of people to show. Default value is 3.
people people An array of Microsoft Graph person objects. Use this property to access the people loaded by the component. Set this value to load your own people onto the component.
group-id groupId The ID of a Microsoft Entra ID group. This property is used to retrieve the direct members of the group. This property is optional.
user-ids userIds An array of user IDs to display. This property is optional.
people-queries peopleQueries Microsoft Graph queries for customizing the people query response.
person-card personCardInteraction Sets the behavior to show the person card on a rendered person. The default value is set to show the person card on hover(PersonCardInteraction.hover).
show-presence showPresence Determines if a person component should render the presence badge. The default value is false.
resource resource The resource URL to get from Microsoft Graph (for example, /me/people).
scopes scopes A comma-delimited string with permissions to be granted to the component. This property is optional.
version version The API version to use when making the request. Default value is v1.0.
fallback-details fallbackDetails Array of Microsoft Graph person objects representing a person or multiple people when no user/person/contact is found in the graph.

The following example sets the maximum number of people to show.

 

CSS custom properties

The mgt-people component defines the following CSS custom properties.


.people {
  --people-list-margin: 12px;
  --people-avatar-gap: 8px;
  --people-overflow-font-color: orange;
  --people-overflow-font-size: 16px;
  --people-overflow-font-weight: 600;
  --people-person-avatar-size: 70px;
}

To learn more, see styling components.

Templates

The mgt-people supports several templates that you can use to replace certain parts of the component. To specify a template, include a