Back to column formats
Column formattingSharePoint Online

Context Menu

The sample is a simple version of the current context menu. It allows you to customize the menu options and link to the most user of visited links. You can add links to Flows, web pages, or other items specific the the item it is on.

Context Menu 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",
    "justify-content": "space-between"
  },
  "children": [
    {
      "elmType": "div",
      "txtContent": "@currentField",
      "style": {
        "font-size": "11pt",
        "white-space": "nowrap",
        "overflow": "hidden",
        "text-overflow": "ellipsis"
      }
    },
    {
      "elmType": "div",
      "attributes": {
        "iconName": "moreVertical",
        "class": "ms-fontColor-red--hover ms-font-l"
      },
      "style": {
        "cursor": "pointer",
        "padding": "2px"
      },
      "customCardProps": {
        "directionalHint": "rightCenter",
        "openOnEvent": "click",
        "isBeakVisible": true,
        "beakStyle": {
          "backgroundColor": "lightGray"
        },
        "formatter": {
          "elmType": "div",
          "children": [
            {
              "elmType": "div",
              "attributes": {
                "class": "ms-borderColor-ThemeLight"
              },
              "style": {
                "border": "1px solid darkblue"
              },
              "children": [
                {
                  "elmType": "div",
                  "children": [
                    {
                      "elmType": "div",
                      "children": [
                        {
                          "elmType": "div",
                          "txtContent": "='ID '+[$ID]",
                          "attributes": {
                            "class": "ms-bgColor-themePrimary ms-fontColor-themeLighter"
                          },
                          "style": {
                            "font-weight": "600",
                            "text-align": "center",
                            "padding-bottom": "3px",
                            "margin-bottom": "5px",
                            "border-bottom": "1px solid darkblue"
                          }
                        }
                      ]
                    },
                    {
                      "elmType": "div",
                      "attributes": {
                        "class": "ms-bgColor-themeLighter--hover ms-fontColor-black--hover"
                      },
                      "style": {
                        "margin": "5px",
                        "padding": "5px",
                        "cursor": "pointer"
                      },
                      "customRowAction": {
                        "action": "defaultClick"
                      },
                      "children": [
                        {
                          "elmType": "span",
                          "attributes": {
                            "iconName": "OpenInNewWindow"
                          },
                          "style": {
                            "margin-left": "5px",
                            "font-weight": "600"
                          }
                        },
                        {
                          "elmType": "span",
                          "txtContent": "Open",
                          "style": {
                            "margin-left": "9px",
                            "font-weight": "600"
                          }
                        }
                      ]
                    },
                    {
                      "elmType": "div",
                      "attributes": {
                        "class": "ms-bgColor-themeLighter--hover ms-fontColor-black--hover"
                      },
                      "style": {
                        "margin": "5px",
                        "padding": "5px",
                        "cursor": "pointer"
                      },
                      "customRowAction": {
                        "action": "editProps"
                      },
                      "children": [
                        {
                          "elmType": "span",
                          "attributes": {
                            "iconName": "Edit"
                          },
                          "style": {
                            "margin-left": "5px",
                            "font-weight": "600"
                          }
                        },
                        {
                          "elmType": "span",
                          "txtContent": "Edit",
                          "style": {
                            "margin-left": "9px",
                            "font-weight": "600"
                          }
                        }
                      ]
                    },
                    {
                      "elmType": "div",
                      "attributes": {
                        "class": "ms-bgColor-themeLighter--hover ms-fontColor-black--hover"
                      },
                      "style": {
                        "margin": "5px",
                        "padding": "5px",
                        "cursor": "pointer"
                      },
                      "customRowAction": {
                        "action": "delete"
                      },
                      "children": [
                        {
                          "elmType": "span",
                          "attributes": {
                            "iconName": "Delete"
                          },
                          "style": {
                            "margin-left": "5px",
                            "font-weight": "600"
                          }
                        },
                        {
                          "elmType": "span",
                          "txtContent": "Delete",
                          "style": {
                            "margin-left": "9px",
                            "font-weight": "600"
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    }
  ]
}

From the contributor

How to use this sample

Summary

The sample is a simple version of the current context menu. It allows you to customize the menu options and link to the most user of visited links. You can add links to Flows, web pages, or other items specific the the item it is on. It can be added to any customizable field, but adding it to the Title field helps eliminate confusion.

screenshot of the sample screenshot of the sample

Setting Up for Sample Usage

To use this sample, you need to modify __LIST ID__ and __FLOW ID__ in generic-context-menu.json according to your environment. __LIST ID__" is specified on lines 178 and 224, and __FLOW ID__ is specified on line 264.

View requirements

This format can be applied to any column type.

Sample

Solution Author(s)
generic-context-menu.json Larry Pfaff
generic-context-menu-minimal.json Watana

Version history

Version Date Comments
1.0 April 2, 2024 Initial release
1.1 February 17, 2025 Added generic-context-menu-minimal.json

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.