Back to view formats
View formattingSharePoint Online

Message Chat Bubbles

This sample formats your SharePoint list view to look like message chat bubbles! If the Author is the current user, the message will be displayed on the right.

Message Chat Bubbles 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",
  "hideColumnHeader": true,
  "hideSelection": true,
  "rowFormatter": {
    "elmType": "div",
    "style": {
      "display": "flex",
      "flex-direction": "row",
      "align-items": "flex-start",
      "width": "600px",
      "margin": "15px"
    },
    "children": [
      {
        "elmType": "div",
        "style": {
          "display": "flex",
          "justify-content": "center",
          "width": "15%"
        },
        "children": [
          {
            "elmType": "img",
            "defaultHoverField": "[$Author]",
            "attributes": {
              "src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + [$Author.email]",
              "title": "[$Author.title]"
            },
            "style": {
              "display": "=if([$Author.email] == @me, 'none' , 'block')",
              "width": "50px",
              "height": "50px",
              "border-radius": "50%"
            }
          }
        ]
      },
      {
        "elmType": "div",
        "style": {
          "display": "flex",
          "justify-content": "=if([$Author.email] == @me, 'flex-end' , 'flex-start')",
          "width": "70%"
        },
        "children": [
          {
            "elmType": "div",
            "style": {
              "display": "flex",
              "flex-direction": "column",
              "width": "80%",
              "padding": "15px",
              "border-radius": "10px"
            },
            "attributes": {
              "class": "=if([$Author.email] == @me, 'ms-bgColor-themeLighter' , 'ms-bgColor-neutralLighter')"
            },
            "children": [
              {
                "elmType": "div",
                "style": {
                  "padding-bottom": "3px"
                },
                "children": [
                  {
                    "elmType": "span",
                    "style": {
                      "padding-right": "10px"
                    },
                    "txtContent": "[$Author.title]"
                  },
                  {
                    "elmType": "span",
                    "txtContent": "[$Created]"
                  }
                ]
              },
              {
                "elmType": "div",
                "txtContent": "[$Title]",
                "style": {
                  "display": "=if([$Title] == '' , 'none' , 'block')",
                  "padding-bottom": "3px"
                },
                "attributes": {
                  "class": "ms-fontSize-18 ms-fontWeight-bold"
                }
              },
              {
                "elmType": "div",
                "txtContent": "[$Message]",
                "attributes": {
                  "class": "ms-fontSize-14"
                }
              }
            ]
          }
        ]
      },
      {
        "elmType": "div",
        "style": {
          "display": "flex",
          "justify-content": "center",
          "width": "15%"
        },
        "children": [
          {
            "elmType": "img",
            "defaultHoverField": "[$Author]",
            "attributes": {
              "src": "='/_layouts/15/userphoto.aspx?size=S&accountname=' + [$Author.email]",
              "title": "[$Author.title]"
            },
            "style": {
              "display": "=if([$Author.email] == @me, 'block' , 'none')",
              "width": "50px",
              "height": "50px",
              "border-radius": "50%"
            }
          }
        ]
      }
    ]
  }
}

From the contributor

How to use this sample

Summary

This sample formats your SharePoint list view to look like message chat bubbles! If the Author is the current user, the message will be displayed on the right.

screenshot of the sample

View requirements

Type Internal Name Required
Single line of text Title
Multi line of text Message Yes
Person Author Yes
DateTime Created Yes
  • Show the default column Author and Created column in the view.
  • If you want to display the latest messages at the top, please sort them in descending order by Created.

Sample

Solution Author(s)
message-chat-bubbles.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 November 19, 2020 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.