Home SharePoint Online SharePoint Online Column Formatting Options

SharePoint Online Column Formatting Options

I wanted an exhaustive list (to be updated in future with updates) of SharePoint List Column Formatting options from this GitHub repo. 

It allows to format a SharePoint Online or SharePoint 2019 list or document library using some JSON code.

For SharePoint 2019, there are limitation and few things to know.

Chris Kent has released a great tool as SPFX webpart helping designing your column formatting, make sure you check it out.

Click on each header, to access the detailed page about how to achieve each formatting.

I update this article manually, so more column formatting may be available on the github page. 

Last article update : 13.10.2020

Enjoy 😁

Formatting an item when a date column is before or after today’s date


Turn field values into hyperlinks

 

Project Indicator Formats

screenshot41

Project Register where ‘Current Status’ column is formatted based on the RYAG status. 

screenshot8

Conditional formatting based on a number range


Format a number column as a data bar

screenshot of the Simple Data Bar

screenshot of the Percentage Data Bar

Show trending up/trending down icons


Conditional formatting based on the value in a text or choice field


Traffic Light (Red-Yellow-Green) Status Indicator


Formatting Yes/No field to check mark based on the value in the field


Yes/No Column Check Mark


Concatenate Currency Symbol to Numeric Columns (added 07/02/2018)

budgetcolumnformating.png

Displays a customizable Google map image for a given location

screenshot7

Display Twitter profile pics using Twitter handles

screenshot6

Formatting percentage number (%) to pie chart.

number-piechart

Highlight the current user

screenshot of the sample

Display a picture column as a circle

screenshot4

Display a person’s profile picture in a circle

screenshot3

Create a button to launch a Flow for the selected item

screenshot of the sample

SVG icons

screenshot1

Smiley faces for good quiz results

screenshot of the sample

Formatting an ISBN (text column) to book cover image. Images are retrieved by calling Open Library Covers API.

Summary

This example retrieves book cover images based on their ISBN numbers by utilizing the Open Library Covers API. The API works by building a cover image URL with the ISBN.

text-isbn-image

Formatting column with long text to multiple-line with word wrap.

screenshot of the sample

Strikethrough on Completion

screenshot of the sample

Display Twitter profile pics using Twitter handles

screenshot of the sample

Display social media profile pics using social media handles

screenshot of the sample

Turn FileRef field into clickable thumbnail hyperlink

screenshot of the sample

Centered Content

screenshot of the sample

Creating Red-Amber-Green (RAG) bars based on date ranges

screenshot of the sample

Concatenate Currency Symbol to Numeric Columns

screenshot of sample

Demonstrates how to link to a local resource

screenshot of the sample

Note – this format only provides the link shown above in the “List” column. The image is related to the text-local-imagesample. The image also just shows a link. The real power is in clicking on the link regardless of location.

Demonstrates how to reference a local image

screenshot of the sample

Row Actions

screenshot of the sample

Create a button to conditionally launch a Flow for the selected item

screenshot of the sample

Multi-Choice forEach

screenshot of the sample

Multi-Choice Icons

screenshot of the sample

Multi-Person Facepile

screenshot of the sample

User Profile Picture sizes

Key Size
S 48×48
M 72×72
L 300x?*

Determine Tolerance Comparison using abs()

screenshot of the sample

Icon Progress Bar

screenshot of the sample

Displays a customizable Bing Map image for a given location in a Multi-Line of Text Field

screenshot of the sample

Text Contains

screenshot of the sample

Text StartsWith Calling Codes

screenshot of the sample

File Thumbnails

screenshot of the sample

Publishing Status

Before screenshot of the sample before formatting Afterscreenshot of the sample after formatting

Display Location Address Details

Summary

Location columns provide several properties that can be accessed to provide more information to users. This sample pulls out sub properties to turn the standard Display Name only to a full address and provides a link to Bing Maps for a given location.

screenshot of the sample

Multi-Person Teams Chat Link

Summary

This sample demonstrates creating a deep link to a Microsoft Teams chat. This format works both within Microsoft Teams and within SharePoint Online.

screenshot of the sample in Microsoft Teams

screenshot of the sample in a Modern List View

Custom hover card on Lists

Summary

The following image shows a list with a custom hover added to a List:

On hover – Metadata on the column “Status” is made available via column formatting

screenshot of the sample

Date Difference

Summary

This sample demonstrates calculating the difference between 2 dates. In this sample the age in years is calculated based on the date of birth and the date of death. This format could easily be adjusted to calculate a different unit of time (months, days, hours, minutes, etc.) by adjusting the multiplier.

screenshot

Icon Overlays

Summary

You can UI Fabric Icons within your column and view formats. This sample demonstrates combining multiple icons by overlaying to create colorful icons that can indicate more information than a single icon can.

Overlays are done by using a parent element with a style -> position value of relative. Then we can have the child elements use a position value of absolute to precisely overlay the icons where we want them.

generic-icon-overlay.json

This sample demonstrates using a solid icon (HeartFill) to provide a colored background to our icon and overlaying a wireframe icon to create an outline. The icons are shown conditionally based on the value. Using this technique with the various Solid, Mask, and Fill icons available can create far more icons than are currently available and allows more precise control of the coloring.

screenshot of the sample

Number Gauge

Summary

This sample demonstrates combining a fixed SVG (gauge background) with a dynamic SVG (needle). It makes understanding number columns (percent) very intuitive.

screenshot

Formatting a column when a date column is blank

screenshot of the sample

Formatting column with long text to multiple-line with word wrap.

Summary

With modern document libraries and lists, lengthy multi-line fields no longer show text in full (a fade is provided). This isn’t always desired, so this sample demonstrates rending long text to mutilple lines with word wrap, similar to classic mode.

screenshot of the sample

Work Progress Category Pill

screenshot of the sample

Display social media profile pics using social media handles

screenshot of the sample

Issue Status Pill

screenshot of the sample

File Preview

Summary

This sample opens Microsoft Office documents in full screen within a new tab. This is the same view as used in the fileviewer webpart (no toolbars).

screenshot of the sample

Default hover card on Lists

Summary

The following image shows a list with a defalut hover added to a formatted column in a list

On hover on a formatted person column a profile card is displayed

screenshot of the sample

Custom hover card on Lists

Summary

The following image shows a list with a custom hover added to a List:

On hover – Metadata on the column “Status” is made available via column formatting

screenshot of the sample

Wrap up

Again those samples are all available on PNP Github.

Which one are you using ? Which one you wish to see as Column formatting ?

- Advertisement -

14 COMMENTS

  1. Jeff was very helpful with giving me ideas and solutions (that I modified to fit my own needs) in solving an issue with a SharePoint list. He was very responsive to my questions and asked good questions in return to better understand what I was trying to accomplish. He was very helpful, as is his web site Office 365 Notes.

  2. This works fine. Only issue is if you have a calculated date column in the same library as the column you add formatting to the date format switches to the JSON Data and time and looks terrible, not sure if this is a feature or a bug?! Using JSON in any column sets JSON for all columns even if not code entered so some calculated columns get odd outputs. just to be aware of this.

  3. Is there a way to format column based on duplicate values. I have a view that uses a Group By based on a column. What could be a best option to find the count and apply a a background color if count of group by is greater than 1.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

CONNECT FOR MORE CONTENT

DO NOT MISS THOSE ARTICLES

SharePoint View Formatting Options

Following the article - Column Formatting options let's have the same exercise for this feature View Formatting announced during SharePoint Conference 2018. This is a...

SharePoint Online Column Formatting Options

sharepoint online column formatting, formattage de colonne sharepoint

How to connect to multiple tenants in Microsoft Teams ! The user friendly guide

So you have Teams for your own company, and your customer invites you as a guest to his tenant (Article - Expand your collaboration with...

Channel vs Chat ? When to use what in Microsoft Teams

Microsoft Teams Users tend to chat privately using the Chat feature naturally. Microsoft Teams Channel are much more powerful though. Summary of some important features...

Recent Comments