Back to column formats
Column formattingSharePoint Online

Display Tags

This sample demonstrates changing managed metadata values to tag-like appearance.

Display Tags formatting preview
Sample preview · View original image

Copy. Apply. Make it yours.

Get this format

2 definitions

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",
  "style": {
    "display": "flex",
    "flex-wrap": "wrap"
  },
  "children": [
    {
      "elmType": "div",
      "style": {
        "margin": "5px"
      },
      "forEach": "tag in @currentField",
      "children": [
        {
          "elmType": "div",
          "style": {
            "display": "flex",
            "flex-direction": "row",
            "align-items": "center"
          },
          "children": [
            {
              "elmType": "div",
              "style": {
                "border-top": "12px solid transparent",
                "border-bottom": "12px solid transparent",
                "border-right": "10px solid"
              },
              "attributes": {
                "class": "ms-fontColor-themePrimary"
              }
            },
            {
              "elmType": "div",
              "style": {
                "display": "flex",
                "flex-direction": "row",
                "align-items": "center",
                "height": "24px",
                "white-space": "nowrap",
                "border-top-right-radius": "3px",
                "border-bottom-right-radius": "3px"
              },
              "attributes": {
                "class": "ms-bgColor-themePrimary"
              },
              "children": [
                {
                  "elmType": "div",
                  "style": {
                    "width": "6px",
                    "height": "6px",
                    "border-radius": "50%"
                  },
                  "attributes": {
                    "class": "ms-bgColor-white"
                  }
                },
                {
                  "elmType": "div",
                  "txtContent": "[$tag]",
                  "style": {
                    "padding-left": "6px",
                    "padding-right": "10px"
                  },
                  "attributes": {
                    "class": "ms-fontColor-white ms-fontSize-s"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample demonstrates changing managed metadata values to tag-like appearance.

screenshot of the sample

View requirements

This format can be applied to a Managed Metadata column. Or it can be applied to a Choice Column too.

Sample

Solution Author(s)
managed-metadata-tag.json Tetsuya Kawahara
managed-metadata-tag-multiple-values.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 September 17, 2023 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.