Forum Discussion

ConnM's avatar
ConnM
Copper Contributor
May 15, 2024

JSON Header Formatting SharePoint list - Subheading

Hi    I have a SharePoint list form, and I have been asked to add "Something small in the header to say 'For Internal Use Only'"   I am struggling to change the JSON to add a subheading. Can anyo...
  • Rob_Elliott's avatar
    May 15, 2024

    ConnM yes you can do this but it can't pick up the list description so you will need to have a column in your list for the subtitle text. But the advantage of that is that the text can then be different for each item.  My column for the subtitle is called Note.

     

     

    {
        "elmType": "div",
        "attributes": {
            "class": "ms-bgColor-themePrimary ms-fontColor-white"
        },
        "children": [
            {
                "elmType": "div",
                "style": {
                    "margin": "10px",
                    "width": "100%",
                    "border": "none",
                    "padding": "10px",
                    "display": "=if([$Title] == '' , 'none' , 'flex')",
                    "flex-direction": "column"
                },
                "children": [
                    {
                        "elmType": "div",
                        "txtContent": "[$Title]",
                        "style": {
                            "text-align": "left"
                        },
                        "attributes": {
                            "class": "ms-fontSize-28 ms-fontWeight-bold"
                        }
                    },
                    {
                        "elmType": "div",
                        "txtContent": "[$Note]",
                        "style": {
                            "text-align": "left",
                            "display": "=if([$Note] == '' , 'none' , '')"
                        },
                        "attributes": {
                            "class": "ms-fontSize-16"
                        }
                    }
                ]
            }
        ]
    }

     

     

    This is the result:

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User.
    Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

Resources