Back to column formats
Column formattingSharePoint Online

Multiple hyperlinks in single field

Using this sample you can have multiple hyperlinks in a single field.

Multiple hyperlinks in single field 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.

Column formatting
Download JSON
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "style": {
    "display": "flex",
    "align-items": "flex-start",
    "justify-content": "space-between",
    "padding": "4px 0"
  },
  "children": [
    {
      "elmType": "div",
      "style": {
        "display": "=if(@currentField=='','none','flex')",
        "flex-direction": "column",
        "align-items": "flex-start"
      },
      "children": [
        {
          "elmType": "a",
          "forEach": "listItem in split(@currentField,'[')",
          "txtContent": "=substring([$listItem],0,indexOf([$listItem],']'))",
          "style": {
            "margin-bottom": "1px",
            "display": "=if([$listItem]=='','none','')",
            "padding": "2px 15px",
            "border-radius": "15px",
            "text-decoration": "none",
            "font-size": "14px"
          },
          "attributes": {
            "class": "ms-bgColor-themeLighter ms-bgColor-themeLight--hover ms-fontColor-neutralPrimaryAlt ms-fontColor-themePrimary--hover",
            "href": "=replaceAll(substring([$listItem],indexOf([$listItem],']')+1,indexOf([$listItem]+'^','^')),'\n','')",
            "target": "_blank"
          }
        }
      ]
    },
    {
      "elmType": "span",
      "customRowAction": {
        "action": "editProps"
      },
      "attributes": {
        "iconName": "Edit",
        "class": "ms-fontSize-s ms-bgColor-themeLight ms-bgColor-neutralTertiary--hover"
      },
      "style": {
        "display": "inline-block",
        "cursor": "pointer",
        "margin": "0 5px",
        "padding": "4px",
        "border-radius": "100px"
      }
    }
  ]
}
Schema compatibility review notes

This historical definition differs from the pinned Microsoft schema. This may indicate an unsupported pattern or a schema limitation. Check the original requirements and test in your tenant before use.

  • /children/0/children/0/forEach must match pattern "^[^\]\$@\. ]+ in (\@currentField|\[\$.+\])$"

From the contributor

How to use this sample

Summary

Using this sample you can have multiple hyperlinks in a single field.

screenshot of the sample

View requirements

  • This format can be applied to a Multi lines of text column
  • The links can to be introduced with an alternative text by preceding them with square brackets, for example, [List Formatting Samples]https://pnp.github.io/List-Formatting/ seperating each link in a new row of the multi-line column using SHIFT+ENTER
  • The following is an example value
    [Microsoft 365 & Power Platform Community]https://pnp.github.io/
    [Sharing Is Caring]https://pnp.github.io/sharing-is-caring/
    [M365 Platform & Power Platform Community Recognition Program]https://pnp.github.io/recognitionprogram/
    

Sample

Solution Author(s)
text-multiple-hyperlinks.json Geert de Kooter

Version history

Version Date Comments
1.0 January 26, 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.


Additional notes

None