Back to view formats
View formattingSharePoint Online

Person Cards

This sample demonstrates creating a basic person card. You can use this as a quick contact list.

Person Cards formatting preview
Sample preview · View original image

Copy. Apply. Make it yours.

Get this format

1 definition

Review the requirements below, then paste this JSON into the matching formatting panel. Show me where.

Use your list's internal column names and replace any tenant-specific URLs or flow IDs. Formatting is presentation, not a way to secure data.

View formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
  "hideSelection": true,
  "hideListHeader": true,
  "rowFormatter": {
    "elmType": "div",
    "style": {
      "float": "left",
      "margin": "10px",
      "padding": "5px",
      "min-width": "340px"
    },
    "attributes": {
      "class": "ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover"
    },
    "children": [
      {
        "elmType": "div",
        "children": [
          {
            "elmType": "img",
            "style": {
              "display": "block",
              "height": "auto",
              "max-height": "120px",
              "border-radius": "50%"
            },
            "attributes": {
              "src": "='/_layouts/15/userphoto.aspx?size=S&username=' + [$Person.email]"
            }
          }
        ]
      },
      {
        "elmType": "div",
        "style": {
          "text-align": "center",
          "padding": "5px",
          "margin": "auto"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "font-weight": "500",
              "font-size": "1.5rem"
            },
            "txtContent": "[$Title]"
          },
          {
            "elmType": "div",
            "style": {
              "font-weight": "500",
              "font-size": "1.1em",
              "overflow": "hidden",
              "max-width": "280px",
              "white-space": "nowrap"
            },
            "txtContent": "[$JobTitle]"
          },
          {
            "elmType": "div",
            "txtContent": "[$PhoneNumber]"
          }
        ]
      },
      {
        "elmType": "div",
        "children": [
          {
            "elmType": "span",
            "style": {
              "height": "2rem",
              "width": "2rem",
              "font-size": "2em",
              "cursor": "pointer",
              "margin": "0px 5px",
              "vertical-align": "text-bottom"
            }
          },
          {
            "elmType": "span",
            "style": {
              "height": "2rem",
              "width": "2rem",
              "font-size": "2em",
              "cursor": "pointer",
              "margin": "0px 5px",
              "vertical-align": "text-bottom",
              "display": "=if([$LinkedIn]=='','none','')"
            },
            "children": [
              {
                "elmType": "a",
                "style": {
                  "cursor": "pointer"
                },
                "attributes": {
                  "class": "ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover",
                  "iconName": "LinkedInLogo",
                  "href": "=[$LinkedIn]",
                  "title": "LinkedIn"
                }
              }
            ]
          },
          {
            "elmType": "span",
            "style": {
              "height": "2rem",
              "width": "2rem",
              "font-size": "2em",
              "cursor": "pointer",
              "margin": "0px 5px",
              "vertical-align": "text-bottom",
              "display": "=if([$Person]=='','none','')"
            },
            "children": [
              {
                "elmType": "a",
                "style": {
                  "cursor": "pointer"
                },
                "attributes": {
                  "class": "ms-bgColor-neutralLighterAlt ms-bgColor-neutralLight--hover ms-fontColor-themePrimary--hover",
                  "iconName": "OutlookLogo",
                  "href": "='mailto:' + [$Person.email]",
                  "title": "Email"
                }
              }
            ]
          }
        ]
      }
    ]
  }
}

From the contributor

How to use this sample

Summary

This sample demonstrates creating a basic person card. You can use this as a quick contact list.

screenshot of the sample

View requirements

Column Name Type of Column Internal Column Name
Title Single line of Text Title
LinkedIn HyperLink LinkedIn
Job Title Single line of Text JobTitle
Phone Number Single line of Text PhoneNumber
Person Person Person

Sample

Solution Author(s)
person-cards.json David Ramalho

Version history

Version Date Comments
1.0 November, 2019 Initial release

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

Additional notes

If you intend to add a sample list of this list formatting, take a look at the following article that contains PowerShell information on how to deploy this.