Microsoft Lists column formatting

In this SharePoint Online tutorial, we will see, sharepoint column formatting examples and sharepoint column formatting json examples.

We will see, how to do column formatting in a modern list in SharePoint Online Office 365. As we know Microsoft provided many new features on the SharePoint modern page, this is one of the good features in SharePoint Online modern lists.

We cant see this feature in SharePoint classic page.

SharePoint column formatting

SharePoint Column formatting does not affect data in lists or libraries. It changes the display of lists/libraries with the various colors, icons, font effect, etc. For this, we have to construct a JSON object to describes the elements that are displayed in the browser.

Complete SharePoint Training Course Just for $199 [Just for Today]

Read: SharePoint modern list view customization example

SharePoint column formatting examples

Let us see an example on SharePoint Online modern list column formatting.

Step 1: Log in to the SharePoint Online Office 365 site -> Go to Site Contents -> Create a list as per the below screenshot.

sharepoint modern list column formatting

Step 2: Next click on any column in the SharePoint Online list and go to Column settings -> Format this column

sharepoint column formatting examples

Step 3: Once you click on Format this column, you will get default background colors to set in your list column.

sharepoint online modern list column formatting

Step 4: You can choose any other colors as per the requirement and next click on the Save button.

sharepoint online modern list column formatting examples

Step 5: This is the view of my SharePoint Online list after column formatting.

sharepoint column formatting examples

Step 6: The same steps I have applied for the status column where you can set the color as per the list status value.

sharepoint column formatting json examples

Step 7: The below is the screenshot of my SharePoint Online list column where I change the colors as per the status value.

sharepoint jsom column formatting

Step 8: Below is the final list after I applied the colors in the SharePoint Online list view. We can also apply the condition using code.

sharepoint modern list column formatting examples

This one simple example we saw how to work with sharepoint column formatting.

Read: SharePoint jslink Examples

SharePoint column formatting json examples

Let us see a few examples of sharepoint column formatting JSON examples and I have taken mostly from GitHub.

Microsoft also allows us to customize columns in SharePoint lists and libraries by using column formatting with JSON. By using JSON we can format text, date, people, number and choices field, etc SharePoint list column types.

Now, let us see a few SharePoint column formatting JSON examples.

For this example, we created a list having the title, StartDate, TotalNo.of days, Assigned To, Status column. When we entered some data initially by default list will show you like this.

sharepoint column formatting

Example-1: SharePoint column formatting json Title Column

For this first, we have to click on the Title field. then go to the Column setting. Select Format this column. Then go to Advanced mode. Now just put JSON code.

Title Column Format, with JSON

To preview your formatting, click on Preview. For save, select Save. By Switch to design mode, you can reset your display to default mode.

In this above example, you can clearly see how the title column format. The simplest way to formatting a column is to place the value inside the

element. Here are the codes:

{ "$schema": "//developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField" }

Example-2: SharePoint column formatting json Number

This example will show you using conditional formatting, how a number column is formatted with JSON. when the value of the current field is less than or equal to 10 then it will highlight the value of the field. And it will be normal when the value is greater than 10.

similarly go to advance mode. Apply JSON there. The field will be come like this:

sharepoint column formatting json number field

Follow this below code for formatting a number column using Conditional statement:

{ "$schema": "//developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "class": "=if[@currentField

Chủ Đề