Forum Discussion

AngeloEG's avatar
AngeloEG
Copper Contributor
Feb 24, 2020
Solved

JSON Clickable Action and sp-field-quickActions

Hi,   I'm trying to format a quickfield action to open a task view link.   Everything works as intended but I can't format the icon; the most it does is change to red when using the sp-field-tren...
  • orchee's avatar
    Feb 25, 2020

    AngeloEG So there are few things to mention:

    1. sp-field-quickActions class does not exist - there is only sp-field-quickAction, but this does not matter.
    2. These are the properties you will find in quickAction
    .sp-field-quickAction {
      padding: 0;
    }
    [dir="ltr"] .sp-field-quickAction {
      padding-left: 8px;
    }
    [dir="rtl"] .sp-field-quickAction {
      padding-right: 8px;
    }

    So literally nothing that could make your icon more colorful.

     3. You render <A/> and you get OOTB browser experience, that is why you get treatment with underline and colors for :visited

     

    You can use something like this to get you started, and use fonts and colors right:

        "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
        "debugMode": true,
        "elmType": "div",
        "children": [
          {
            "elmType": "span",
            "txtContent": "Whatever",
            "attributes": {
                "class": "sp-field-quickAction"
            }
          },
          {
            "elmType": "a",
            "style":{
                "text-decoration": "inherit",
                "color": "inherit",
                "font-size": "inherit",
                "font-weight":"inherit"
            },
            "attributes": {
              "class": "sp-field-quickAction sp-field-iconRightAligned",
              "iconName": "TaskLogo",
              "target": "_blank",
              "href": "/"
            }
          }
        ]
      }

Resources