SharePoint Online modern list view customization using JSON

In this tutorial we will discuss SharePoint Online modern list view customization using JSON. Here, we will know how to customize a SharePoint Online modern list using JSON.

As we know in the year 2016, SharePoint online team released Modern List and Library experience in both SharePoint On-Premise and online. So now a day business recommends this feature for more benefits.

So here I am not using JSLink to customize our modern SharePoint Online list rather than, I am going forward to use JSON for an excellent user interface.

If we go in detail, there are many good features added in both modern lists and libraries but here I am using those called List View Customization.

SharePoint online modern list view customization (Product List)

Step 1: I have created a SharePoint Online List called Product List and it contains the following column name.

  • Title – Single Line Text
  • ProdDetails- Multi Line Text.
  • Price – Single Line Text
  • Photo : Hyperlink
  • Rating: Number
sharepoint online modern list view customization

Step 2: Next click on All Items and click on Format View to implement our customization code.

how to custmize SharePoint list view using json

Step 3: Next copy the below code and paste it inside code editor and click on Save.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
  "hideSelection": true,
  "hideColumnHeader": true,
  "rowFormatter": {
    "elmType": "div",
    "_comment_": "ProductPhoto DIV",
    "attributes": {
      "class": "ms-bgColor-greenLight"
    },
    "style": {
      "display": "flex",
      "flex-wrap": "wrap",
      "align-items": "stretch",
      "padding": "16px",
      "margin-bottom": "16px",
      "max-width": "600px",
      "border-radius": "35px"
    },
    "children": [
      {
        "elmType": "div",
        "__comment": "DIV L1",
        "style": {
          "flex-grow": "1",
          "display": "flex",
          "flex-direction": "column",
          "flex-wrap": "nowrap",
          "align-items": "stretch",
          "max-width": "300px"
        },
        "attributes": {
          "class": "ms-bgColor-white"
        },
        "children": [
          {
            "elmType": "span",
            "txtContent": "= [$Title]",
            "style": {
              "display": "block",
              "text-align": "center"
            },
            "attributes": {
              "class": "ms-fontSize-l ms-fontWeight-bold ms-fontColor-neutralPrimary"
            }
          },
          {
            "elmType": "span",
            "txtContent": "[$ProdDetails]",
            "style": {
              "display": "block",
              "text-align": "right",
              "padding": "20px"
            },
            "attributes": {
              "class": "ms-fontSize-l ms-fontWeight-normal ms-fontColor-neutralPrimary"
            }
          },
          {
            "elmType": "span",
            "txtContent": "[$Price]",
            "style": {
              "display": "block",
              "text-align": "left"
            },
            "attributes": {
              "class": "ms-fontSize-m ms-fontWeight-bold ms-fontColor-neutralPrimary"
            }
          }
        ]
      },
      {
        "elmType": "div",
        "__comment": "DIV L2",
        "style": {
          "flex-grow": "1",
          "display": "flex",
          "flex-direction": "column",
          "align-items": "center",
          "max-width": "300px"
        },
        "attributes": {
          "class": "ms-bgColor-white"
        },
        "children": [
          {
            "elmType": "img",
            "style": {
              "width": "260px",
              "height": "160px"
            },
            "attributes": {
              "src": "[$Photo]"
            }
          },
          {
            "elmType": "span",
            "txtContent": "[$Rating]",
            "style": {
              "display": "block",
              "padding-right": "5px",
              "align-items": "right"
            },
            "attributes": {
              "class": "ms-fontSize-m ms-fontWeight-semibold ms-fontColor-themePrimary",
              "iconName": "FavoriteStarFill"
            }
          }
        ]
      }
    ]
  }
}

Step 4: Once I click on the Save button, My SharePoint Online List view got changed to different views which same as the below screenshot.

image 215

This is all about customization of List View in SharePoint Modern List.

Reference: for ms-bgcolor change , you can follow the below URL:

You may like following SharePoint customization tutorials:

In this tutorial we learned SharePoint online modern list view customization using JSON.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>