Adding a header to the SharePoint list form

Adding Header To SharePoint List Form
Contents

    In this article we will look at how to add a header element to the form. For convenience, we’ll add a logo to the header. You can use visual indicators, color bands, and more. Use the SharePoint formatting syntax references, it will be easier 🙂

    Add header

    Step 1

    Click on “New” and select “Configure layout”.

    Adding Header To SharePoint List Form
    Adding a header to the SharePoint list form 6

    Step 2

    In the Format section, make sure that Apply formatting to as ‘Header’ is selected.

    Adding Header To SharePoint List Form1
    Adding a header to the SharePoint list form 7

    Step 3

    In the JSON formatting field, apply the JSON code below to add information to the header section. Here we are trying to put a logo in the header.

    Notice

    Be sure to change the “src” to a relative url to your company logo.

    {  
        "debugmode": "true",  
        "elmType": "div",  
        "attributes": {  
            "class": "ms-bgColor-white"  
        },  
        "style": {  
            "width": "99%",  
            "border-top-width": "0px",  
            "border-bottom-width": "1px",  
            "border-left-width": "0px",  
            "border-right-width": "0px",  
            "border-style": "solid",  
            "margin-bottom": "16px"  
        },  
        "children": [  
            {  
                "elmType": "div",  
                "style": {  
                    "display": "flex",  
                    "box-sizing": "border-box",  
                    "align-items": "center"  
                },  
                "children": [  
                    {  
                        "elmType": "img",  
                        "style": {  
                            "width": "150px"  
                        },  
                        "attributes": {  
                            "src": "RELATIVE URL TO LOGO"  
                        }  
                    }  
                ]  
            },  
            {  
                "elmType": "div",  
                "attributes": {  
                    "class": "ms-fontColor-blueMid ms-fontWeight-bold ms-fontSize-24"  
                },  
                "style": {  
                    "box-sizing": "border-box",  
                    "width": "100%",  
                    "text-align": "left",  
                    "padding": "21px 12px",  
                    "overflow": "hidden"  
                },  
                "children": [  
                    {  
                        "elmType": "div",  
                        "txtContent": "=if ([$Title] == '', 'New Item', 'Item: ' + [$Title])"  
                    }  
                ]  
            }  
        ]  
    }  
    Adding Header To SharePoint List Form2
    Adding a header to the SharePoint list form 8

    Step 4

    Observe the logo after the formatting is saved successfully. You may need to update your browser

    Adding Header To SharePoint List Form3
    Adding a header to the SharePoint list form 9

    Step 5

    Troubleshoot if the logo does not appear. if the logo does not appear. If it still doesn’t work, observe the JSON formatting being saved and investigate any formatting issues using the developer tools. You can copy the code from the Git Hub reference in the reference section and modify the code to suit your needs.

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

    Updated on 27. March 2024
    Was this article helpful?

    Leave a Reply

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