Back to column formats
Column formattingSharePoint Online

Work Progress Category Pill

This JSON sample demonstrates how you can format the work progress category choices as pills found in the newly released Microsoft Lists Work progress tracker template.

Work Progress Category Pill  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": {
    "flex-wrap": "wrap",
    "display": "flex"
  },
  "children": [
    {
      "forEach": "__INTERNAL__ in @currentField",
      "elmType": "div",
      "style": {
        "box-sizing": "border-box",
        "padding": "4px 8px 5px 8px",
        "display": "flex",
        "border-radius": "16px",
        "height": "24px",
        "align-items": "center",
        "white-space": "nowrap",
        "overflow": "hidden",
        "margin": "1px 4px 4px 0px"
      },
      "attributes": {
        "class": {
          "operator": ":",
          "operands": [
            {
              "operator": "==",
              "operands": [
                "[$__INTERNAL__]",
                ""
              ]
            },
            "",
            {
              "operator": ":",
              "operands": [
                {
                  "operator": "==",
                  "operands": [
                    "[$__INTERNAL__]",
                    "Planning"
                  ]
                },
                "sp-css-backgroundColor-neutralBackground sp-field-borderBottomRegular sp-field-borderBottomSolid sp-css-borderColor-neutralTertiary",
                {
                  "operator": ":",
                  "operands": [
                    {
                      "operator": "==",
                      "operands": [
                        "[$__INTERNAL__]",
                        "Design"
                      ]
                    },
                    "sp-css-backgroundColor-blueBackground07 sp-field-borderBottomRegular sp-field-borderBottomSolid sp-css-borderColor-blueDark",
                    {
                      "operator": ":",
                      "operands": [
                        {
                          "operator": "==",
                          "operands": [
                            "[$__INTERNAL__]",
                            "Engineering"
                          ]
                        },
                        "sp-css-backgroundColor-successBackground sp-field-borderBottomRegular sp-field-borderBottomSolid sp-css-borderColor-green",
                        {
                          "operator": ":",
                          "operands": [
                            {
                              "operator": "==",
                              "operands": [
                                "[$__INTERNAL__]",
                                "Marketing"
                              ]
                            },
                            "sp-css-backgroundColor-warningBackground sp-field-borderBottomRegular sp-field-borderBottomSolid sp-css-borderColor-neutralTertiary",
                            {
                              "operator": ":",
                              "operands": [
                                {
                                  "operator": "==",
                                  "operands": [
                                    "[$__INTERNAL__]",
                                    "Research"
                                  ]
                                },
                                "sp-css-backgroundColor-errorBackground sp-field-borderBottomRegular sp-field-borderBottomSolid sp-css-borderColor-themeDarkAlt",
                                ""
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      },
      "children": [
        {
          "elmType": "span",
          "style": {
            "line-height": "16px",
            "height": "14px"
          },
          "attributes": {
            "iconName": {
              "operator": ":",
              "operands": [
                {
                  "operator": "==",
                  "operands": [
                    "[$__INTERNAL__]",
                    ""
                  ]
                },
                "",
                {
                  "operator": ":",
                  "operands": [
                    {
                      "operator": "==",
                      "operands": [
                        "[$__INTERNAL__]",
                        "Planning"
                      ]
                    },
                    "Calendar",
                    {
                      "operator": ":",
                      "operands": [
                        {
                          "operator": "==",
                          "operands": [
                            "[$__INTERNAL__]",
                            "Design"
                          ]
                        },
                        "Like",
                        {
                          "operator": ":",
                          "operands": [
                            {
                              "operator": "==",
                              "operands": [
                                "[$__INTERNAL__]",
                                "Engineering"
                              ]
                            },
                            "Trending12",
                            {
                              "operator": ":",
                              "operands": [
                                {
                                  "operator": "==",
                                  "operands": [
                                    "[$__INTERNAL__]",
                                    "Marketing"
                                  ]
                                },
                                "Mail",
                                {
                                  "operator": ":",
                                  "operands": [
                                    {
                                      "operator": "==",
                                      "operands": [
                                        "[$__INTERNAL__]",
                                        "Research"
                                      ]
                                    },
                                    "People",
                                    ""
                                  ]
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          }
        },
        {
          "elmType": "span",
          "style": {
            "overflow": "hidden",
            "text-overflow": "ellipsis",
            "padding": "0 3px"
          },
          "txtContent": "[$__INTERNAL__]"
        }
      ]
    }
  ]
}

From the contributor

How to use this sample

Summary

This JSON sample demonstrates how you can format the work progress category choices as pills found in the newly released Microsoft Lists Work progress tracker template.

screenshot of the sample

View requirements

  • The multi-choice-workcategory-pill.json format can be applied to any multiple selection choice column, while the text-column-workcategory-pill.json format can be applied to other columns. Both formats expect the column values to be one of the following choices:
    • Planning
    • Design
    • Engineering
    • Marketing
    • Research

Sample

Solution Author(s)
multi-choice-workcategory-pill.json Ganesh Sanap
text-column-workcategory-pill.json Ganesh Sanap & Tetsuya Kawahara

Version history

Version Date Comments
1.0 August 08, 2020 Initial release
1.1 November 1, 2024 Added text-column-workcategory-pill.json
1.2 November 15, 2024 Modified text-column-workcategory-pill.json to change colors and icons based on field values

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

This sample uses some predefined classes also covered in the official documentation of Column Formatting: