1. Home
  2. Knowledge Base
  3. Microsoft
  4. SharePoint
  5. Display hyperlinks as icons in SharePoint lists

Display hyperlinks as icons in SharePoint lists

Instead of a long link, it is much nicer to display an icon! And only if there is an entry in an element. This makes the SharePoint list clearer and more dynamic.

This is how it’s done!

You can copy this json code:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
  "elmType": "div",
  "children": [
    {
      "elmType": "a",
      "attributes": {
        "target": "_blank",
        "iconName": "Folder",
        "class": "sp-field-quickActions",
        "href": "=if(@currentField!='',@currentField,''"
      },
      "style": {
        "display": "=if(@currentField!='', 'block','none !important')",
        "padding-left": "40px"
      }
    }
  ]
}

You can select the icon (“iconName”) from the fabric icons. Here in the example it is “Folder”.

Dieser Beitrag ist auch verfügbar auf: Deutsch (German)

Was this article helpful?

Related Articles

Submit a Comment

Your email address will not be published. Required fields are marked *

Published on - 26. Jun 2020
Modified on - 1. Apr 2024
Views - 26
Likes - 0

Do you need help?

Kontaktiere uns gerne :-)
Contact Support
Skip to content