Back to view formats
View formattingSharePoint Online

Praise Cards

This sample demonstrates how to display Praise Cards. By creating a Praise Card, you can express your appreciation and admiration to others for their daily cooperation and actions!

Praise Card
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/tile-formatting.schema.json",
  "width": 300,
  "height": 450,
  "hideSelection": true,
  "formatter": {
    "elmType": "div",
    "style": {
      "width": "95%",
      "height": "95%",
      "border": "1px solid",
      "box-shadow": "0 3.2px 7.2px 0",
      "border-radius": "6px",
      "display": "flex",
      "flex-direction": "column",
      "justify-content": "center"
    },
    "attributes": {
      "class": "ms-fontColor-neutralTertiaryAlt"
    },
    "children": [
      {
        "elmType": "div",
        "style": {
          "width": "70%",
          "display": "flex",
          "flex-direction": "row-reverse",
          "height": "30px"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "position": "relative",
              "display": "flex",
              "justify-content": "center"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "position": "absolute",
                  "width": "50px",
                  "height": "50px",
                  "border-radius": "50%",
                  "border": "2px solid",
                  "z-index": "2",
                  "display": "flex",
                  "justify-content": "center",
                  "align-items": "center",
                  "font-size": "28px"
                },
                "attributes": {
                  "class": "ms-bgColor-themePrimary ms-fontColor-white",
                  "iconName": "[$Icon]"
                }
              },
              {
                "elmType": "div",
                "style": {
                  "position": "absolute",
                  "top": "45px",
                  "z-index": "1"
                },
                "children": [
                  {
                    "elmType": "div",
                    "style": {
                      "width": "40px",
                      "height": "20px"
                    },
                    "attributes": {
                      "class": "ms-bgColor-themePrimary"
                    }
                  },
                  {
                    "elmType": "div",
                    "style": {
                      "border-left": "20px solid",
                      "border-right": "20px solid",
                      "border-bottom": "10px solid transparent"
                    },
                    "attributes": {
                      "class": "ms-fontColor-themePrimary"
                    }
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "elmType": "img",
        "style": {
          "width": "150px",
          "height": "150px",
          "border-radius": "50%",
          "border": "1px solid"
        },
        "attributes": {
          "src": "=getUserImage([$To.email], 'L')",
          "class": "ms-fontColor-neutralTertiaryAlt"
        },
        "defaultHoverField": "[$To]"
      },
      {
        "elmType": "div",
        "txtContent": "[$To.title]",
        "style": {
          "font-size": "15px",
          "padding": "5px"
        },
        "attributes": {
          "class": "ms-fontColor-neutralSecondary"
        }
      },
      {
        "elmType": "div",
        "style": {
          "display": "flex",
          "flex-direction": "column",
          "width": "85%",
          "height": "27%",
          "overflow": "hidden",
          "margin-top": "15px"
        },
        "attributes": {
          "class": "ms-fontColor-neutralSecondary"
        },
        "children": [
          {
            "elmType": "div",
            "txtContent": "[$Title]",
            "style": {
              "font-weight": "bold",
              "font-size": "23px"
            }
          },
          {
            "elmType": "div",
            "txtContent": "[$Description]",
            "style": {
              "margin-top": "3px"
            }
          }
        ]
      },
      {
        "elmType": "div",
        "txtContent": "= 'From : ' + [$From.title]",
        "defaultHoverField": "[$From]",
        "style": {
          "width": "90%",
          "display": "flex",
          "flex-direction": "row-reverse",
          "height": "25px",
          "align-items": "center",
          "overflow": "hidden"
        },
        "attributes": {
          "class": "ms-fontColor-neutralSecondary"
        }
      },
      {
        "elmType": "div",
        "style": {
          "width": "90%",
          "display": "flex",
          "justify-content": "space-between",
          "font-size": "17px",
          "margin-top": "10px"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "display": "flex",
              "justify-content": "center",
              "align-items": "center",
              "width": "30px",
              "height": "30px",
              "cursor": "pointer",
              "border-radius": "50%"
            },
            "attributes": {
              "iconName": "OpenPane",
              "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover ms-bgColor-themeLighter--hover"
            },
            "customRowAction": {
              "action": "defaultClick"
            }
          },
          {
            "elmType": "div",
            "style": {
              "display": "flex",
              "flex-direction": "row"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "display": "flex",
                  "flex-direction": "row",
                  "align-items": "center",
                  "cursor": "pointer",
                  "padding": "3px 5px 3px 5px",
                  "border-radius": "5px"
                },
                "attributes": {
                  "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover ms-bgColor-themeLighter--hover"
                },
                "customRowAction": {
                  "action": "setValue",
                  "actionInput": {
                    "Likes": "=if(indexOf([$Likes.email] , @me) > -1 , removeFrom([$Likes.email] , @me) , appendTo([$Likes.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",
                        "style": {
                          "padding": "10px",
                          "font-weight": "bold",
                          "font-size": "20px",
                          "display": "flex",
                          "align-items": "center",
                          "flex-direction": "row"
                        },
                        "attributes": {
                          "class": "ms-fontColor-themePrimary"
                        },
                        "children": [
                          {
                            "elmType": "div",
                            "style": {
                              "margin-right": "5px"
                            },
                            "attributes": {
                              "iconName": "HeartFill"
                            }
                          },
                          {
                            "elmType": "div",
                            "txtContent": "=length([$Likes])"
                          }
                        ]
                      },
                      {
                        "elmType": "div",
                        "children": [
                          {
                            "forEach": "personIterator in [$Likes]",
                            "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": "div",
                    "style": {
                      "margin-right": "5px"
                    },
                    "attributes": {
                      "iconName": "=if(indexOf([$Likes.email] , @me) > -1 , 'HeartFill' , 'Heart' )"
                    }
                  },
                  {
                    "elmType": "div",
                    "txtContent": "=length([$Likes])"
                  }
                ]
              },
              {
                "elmType": "div",
                "style": {
                  "display": "flex",
                  "flex-direction": "row",
                  "align-items": "center",
                  "cursor": "pointer",
                  "padding": "3px 5px 3px 5px",
                  "border-radius": "5px"
                },
                "attributes": {
                  "class": "ms-fontColor-themePrimary ms-fontColor-themeDark--hover ms-bgColor-themeLighter--hover"
                },
                "customRowAction": {
                  "action": "defaultClick"
                },
                "children": [
                  {
                    "elmType": "div",
                    "style": {
                      "margin-right": "5px"
                    },
                    "attributes": {
                      "iconName": "Comment"
                    }
                  },
                  {
                    "elmType": "div",
                    "txtContent": "=if([$_CommentCount] == '' , 0 ,[$_CommentCount])"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

From the contributor

How to use this sample

Summary

This sample demonstrates how to display Praise Cards. By creating a Praise Card, you can express your appreciation and admiration to others for their daily cooperation and actions!

screenshot of the sample

View requirements

Type Internal Name Required
Single line of text Title Yes
Single line of text Description
Person From Yes
Person To Yes
Single line of text Icon
Multi-Select Person Likes
  • You need to use the Gallery View.
  • Set the name of the Fluent UI Icon in the Icon field.

Sample

Solution Author(s)
praise-cards.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 January 23, 2022 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