Back to column formats
Column formattingSharePoint Online

Reacting and displaying users who have reacted

This sample demonstrates how to react and display users who have reacted.

Reacting and displaying users who have reacted formatting preview
Sample preview ยท View original animation

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.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "div",
      "style": {
        "font-size": "18px",
        "padding": "2px 7px 2px 7px",
        "cursor": "pointer",
        "border-radius": "10px"
      },
      "attributes": {
        "class": "ms-bgColor-themeTertiary--hover"
      },
      "customRowAction": {
        "action": "setValue",
        "actionInput": {
          "MultiPersonColumnInteranalName": "=if(indexOf(@currentField.email , @me) > -1 , removeFrom(@currentField.email , @me) , appendTo(@currentField.email , @me) )"
        }
      },
      "customCardProps": {
        "openOnEvent": "hover",
        "directionalHint": "rightCenter",
        "isBeakVisible": true,
        "formatter": {
          "elmType": "div",
          "style": {
            "max-height": "300px",
            "padding": "5px 20px 5px 20px",
            "display": "flex",
            "flex-direction": "column"
          },
          "children": [
            {
              "elmType": "div",
              "txtContent": "= '๐Ÿ’– ' + length(@currentField)",
              "style": {
                "padding": "10px",
                "font-weight": "bold",
                "font-size": "20px"
              }
            },
            {
              "elmType": "div",
              "children": [
                {
                  "forEach": "personIterator in @currentField",
                  "elmType": "div",
                  "style": {
                    "margin-bottom": "5px",
                    "display": "flex",
                    "align-items": "center"
                  },
                  "children": [
                    {
                      "elmType": "img",
                      "style": {
                        "width": "32px",
                        "height": "32px",
                        "border-radius": "50%",
                        "margin-right": "5px"
                      },
                      "attributes": {
                        "src": "=getUserImage([$personIterator.email], 'S')",
                        "title": "[$personIterator.title]"
                      }
                    },
                    {
                      "elmType": "span",
                      "txtContent": "[$personIterator.title]"
                    }
                  ]
                }
              ]
            }
          ]
        }
      },
      "children": [
        {
          "elmType": "span",
          "style": {
            "margin-right": "5px"
          },
          "txtContent": "๐Ÿ’–"
        },
        {
          "elmType": "span",
          "style": {
            "font-weight": "=if(indexOf(@currentField.email , @me) > -1 , 'bold' ,'' )"
          },
          "txtContent": "=length(@currentField)"
        }
      ]
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample demonstrates how to react and display users who have reacted. If the current user reacts, the number will be bolded. Also, this sample uses the setValue of customRowAction to update the field. You need to set the actionInput to the internal name of the column to be updated.

screenshot of the sample

View requirements

This format can be applied to a Multi-Select Person column.

Sample

Solution Author(s)
multi-person-reaction.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 November 21, 2021 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.