Back to column formats
Column formattingSharePoint Online

Managed Metadata Tag Icon

This sample displays a tag icon to the left of the value in the managed metadata column.

Managed Metadata Tag Icon 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",
    "width": "100%"
  },
  "children": [
    {
      "elmType": "div",
      "style": {
        "margin": "5px",
        "padding": "5px 10px 5px 10px",
        "border-radius": "10px"
      },
      "attributes": {
        "class": "ms-bgColor-themePrimary"
      },
      "forEach": "tag in @currentField",
      "children": [
        {
          "elmType": "div",
          "style": {
            "vertical-align": "middle",
            "white-space": "nowrap",
            "width": "auto"
          },
          "attributes": {
            "class": "ms-fontColor-white ms-font-s"
          },
          "children": [
            {
              "elmType": "span",
              "style": {
                "position": "relative",
                "top": "2px"
              },
              "attributes": {
                "iconName": "Tag"
              }
            },
            {
              "elmType": "span",
              "style": {
                "padding-left": "5px"
              },
              "txtContent": "[$tag]"
            }
          ]
        }
      ]
    }
  ]
}

From the contributor

How to use this sample

Summary

This sample displays a tag icon to the left of the value in the managed metadata column.

screenshot of the sample

There are 2 versions of the sample included depending on if your Managed Metadata column is single or multi-value.

View requirements

This format can be applied to a Managed Metadata column.

Sample

Solution Author(s)
managed-metadata-tag-icon.json Tetsuya Kawahara
managed-metadata-tag-icon-multi-choice.json Tetsuya Kawahara

Version history

Version Date Comments
1.0 March 29, 2021 Initial release
1.0 January 14, 2023 Fixed to not display the tag icon if the value is empty.

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.