SharePoint List and Microsoft List Column Formatting Options

SharePoint List and Microsoft List Column Formatting Options

What you’ll find here

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

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.

Tools

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

There is also this tool to convert HTML to JSON, by PnP community

How to use this page ?

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

Question you might have and support

For any question, support, I recommand you open an issue on github.

And please refer to Column formatting documentation (by Microsoft) 

More info

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

Last article update : 22.09.2021

Enjoy 

Sample & Features by Microsoft

  1. Create a button to launch a Flow
  2. Custom cards on hover
  3. Default cards on hover
  4. Column formatter reference
  5. Inline Editing (avoid clicking on edit as grid)
  6. Set single or multiple field values of an Item by clicking on something (using RowCustomAction)

Display Comment Count

Summary

This sample adds a visual indicator to a list item, showing the number of comments present on it

SharePoint List and Microsoft List Column Formatting Options

Page-a-day Calendar

This sample customizes a date column to look like a page-a-day calendar

SharePoint List and Microsoft List Column Formatting Options

View

Inline Column Chart

This sample demonstrates displaying a column chart using SVG.

SharePoint List and Microsoft List Column Formatting Options

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

Turn field values into hyperlinks

Project Indicator Formats

SharePoint List and Microsoft List Column Formatting Options

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

SharePoint List and Microsoft List Column Formatting Options

Conditional formatting based on a number range

Format a number column as a 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

SharePoint List and Microsoft List Column Formatting Options

Traffic Light (Red-Yellow-Green) Status Indicator

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

SharePoint List and Microsoft List Column Formatting Options

Yes/No Column Check Mark

Yes/No Column Toggle

Demonstrates changing the value of the Yes/No column to a toggle. Three different versions of the sample are provided (Toggle, Icon, & Emoji). Also, this sample uses the setValue of customRowAction to update the field. You need to set the actionInput to the internal name of the column to be updated.

SharePoint List and Microsoft List Column Formatting Options

Yes/No Checkbox

This sample uses Office UI Fabric icons and theme classes to provide a better visualization for Yes/No fields while respecting theme colors.

SharePoint List and Microsoft List Column Formatting Options

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

SharePoint List and Microsoft List Column Formatting Options

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.

Renders whole pie based on a number column

screenshot of the sample

Highlight the current user

This sample uses the @me keyword to check if the person field is the current user and shows that person using a different color and weight

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 (Start Power Automate from SharePoint Item)

Use column formatting to create buttons that, when clicked, run Flows on the corresponding list item. The Flow Launch Panel will be displayed after clicking the button allowing the user to specify any required data and then run the flow.

screenshot of the sample

Show a power automate status in a list

<No screenshot to illustrate>

Launch Power App Button

Providing a direct link to an item within Power Apps is easy to do using this sample. To use it follow the instructions below to get the link to your Power App (and replace that portion of the format).

screenshot of the sample

SVG icons

This sample uses the value of the current field to show a custom icon and color.

screenshot1

Smiley faces for good quiz results

Allows teachers to show smiley faces next to quiz results similar to how they do it on paper.

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.

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

Strikethrough on Completion

Classic task lists add a strikethrough style to the task name when the task is marked as completed

SharePoint List and Microsoft List Column Formatting Options

Display Twitter profile pics using Twitter handles

Using just the Twitter handle, Twitter profile pictures are displayed in a circle and clicking them will open the user’s Twitter page in a new window. The handle is also displayed as a tooltip when hovering over the profile image.

SharePoint List and Microsoft List Column Formatting Options

Display social media profile pics using social media handles

Using the social media handles supported by https://unavatar.now.sh, social media profile pictures are displayed in a circle and clicking them will open the user’s social media page in a new window. The handle is also displayed as a tooltip when hovering over the profile image.

SharePoint List and Microsoft List Column Formatting Options

Turn FileRef field into clickable thumbnail hyperlink

This example uses a column to generate a hyperlink to the Item Thumbnail for a document library.

Before

screenshot of the sample

After

screenshot of the sample

Centered Content (center text in sharepoint text column)

This is a basic sample that demonstrates making your content be both vertically and horizontally centered (in the middle) within the cell.

screenshot of the sample

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

This example creates colored data bars on the current field based on DueDate and StartDate fields compared to the current date/time. The bar fills towards 100% as “Today” approaches the due date. A percentage width is determined based on the total number of days between the StartDate of the item and the DueDate of the item.

screenshot of the sample

Concatenate Currency Symbol to Numeric Columns

Project Register where ‘Project Budget’ column is compared with the ‘Expenditure To Date’ column and formated based on the condition with Red or Green color. Please note that both columns must be a number type for this to work.

screenshot of sample

Demonstrates how to link to a local resource

This sample provides multiple formats to illustrate the options available to link to local resources. The primary purpose is to demonstrate the usage of @currentWeb (O365 only) to prevent issues with reusable formats or formats rendered outside of the main list view. This format links to other lists, but this could just as easily be specific pages/files/etc. on a site.

screenshot of the sample

Row Actions (Launch a power automate, user friendly action)

You can use column and view formatting to create buttons that perform pre-defined actions when clicked. This sample provides a quick format that demonstrates the use of each of the possible actions.

Create a button to conditionally launch a Flow for the selected item (power automate)

You can use column formatting to create buttons that, when clicked, run Flows on the corresponding list item. The Flow Launch Panel will be displayed after clicking the button allowing the user to specify any required data and then run the flow. This is demonstrated in the Generic-Start-Flow sample.

This sample demonstrates how to take it further to conditionally change which flow is launched or if a flow button option should be shown at all.

SharePoint List and Microsoft List Column Formatting Options

Multi-Choice forEach

This sample demonstrates usage of the forEach property to create template elements applied to each choice in a multi-select choice field.

screenshot of the sample

Multi-Choice Icons

This sample demonstrates using the indexOf and join functions (O365 only) to test if a multi-select choice field has a selected choice.

screenshot of the sample

Multi-Person Facepile

This sample provides rounded images for each person in a multi-select person field.

screenshot of the sample

Multi-Choice link

This sample shows how we can display multiple links in a single column using the multi-choice column.

Note: If rich text column is used to display links then this sample can be ignored.

SharePoint List and Microsoft List Column Formatting Options

Determine Tolerance Comparison using abs()

Display if a value is within the expected tolerance.

screenshot of the sample

Icon Progress Bar

This sample demonstrates creating a progress bar using icons. The number column represents the stage in a process and the format provides a visual indicator of where an item is in relation to the process by showing the previous steps as completed, highlighting the current step, and indicating which steps remain.

screenshot of the sample

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

Pause
This template uses Bing Maps’ staticmap API which generates an image using a parameterized URL.

screenshot of the sample

Text Contains

This sample test if text contains a given value.

screenshot of the sample

Text StartsWith Calling Codes

Test if text starts with a given value. Using the international calling code at the start of a phone number, the correct country’s flag is shown next to the phone number.

screenshot of the sample

File Thumbnails

Create an inline preview for document libraries. Folders and filetypes where previews are not available will not display at all.

screenshot of the sample

Publishing Status

Before  After 

Display Location Address Details

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

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

Custom hover card on Lists

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

screenshot of the sample

Approval Status Hover Card (Power Automate Status Progress)

Summary

This sample provides more detail on list/library items when the standard Conent Approval flow is enabled. The approval status and a related icon/color are shown with additional details about the overall process visible in a panel on hover.

SharePoint List and Microsoft List Column Formatting Options

Date Difference

Summary

This sample demonstrates calculating the difference between 2 dates.

screenshot

Icon Overlays

This sample demonstrates using a solid icon based on choice column

screenshot of the sample
screenshot of the sample

Number Gauge

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

Work Progress Category Pill

Based on a choice column

screenshot of the sample

File Preview

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

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

screenshot of the sample

Person Mail To Link

Mailto on a person name (link configured by you in json), it’ll open Outlook New Email Window

Mail To Button

Demonstrates making a mailto link (opens email with prepopulated values) button that references a different field.

screenshot of the sample
screenshot of the sample

Doughnut Chart

This sample changes the appearance of the values in number columns (percent) to a donut chart. The donut chart is displayed using svg.

screenshot of the sample

Number Battery

Summary

This sample changes the appearance of the values in number columns (percent) to look like a battery.

screenshot of the sample

Multi-lookup fields and projected fields

For lookup column, maybe you don’t want out of the box link and formatting, this improve the formatting :

screenshot of the sample

Managed Metadata Tag Icon

This sample displays a tag icon to the left of the value in the managed metadata column.

screenshot of the sample

Display Location Weather Details

This sample utilizes sub properties of a Location column to build an image src that pulls weather from WeatherForYou.com.

screenshot of the sample

Image Lightbox

This sample demonstrates showing the full size image in a lightbox (hover card) rather than opening this image in a new window.

SharePoint List and Microsoft List Column Formatting Options

YouTube Thumbnail

This sample provides a thumbnail of a YouTube video that links to the video and a larger preview image on hover.

screenshot of the sample

Yearly Gantt Chart

This sample demonstrates the display of a yearly Gantt chart.

SharePoint List and Microsoft List Column Formatting Options

Timeline Format

This sample demonstrates displaying a timeline in a column. If the column value is empty, no circle will be displayed. The content of the column will be shown in a popup when you click on the dot.

screenshot of the sample

Time Schedule

This sample demonstrates a time schedule with a filled background from Start time to End time.

screenshot of the sample

Linking to the scheduling dialog in Microsoft Teams and Microsoft Outlook

This sample demonstrates creating deep links to the scheduling dialog in Microsoft Teams and Microsoft Outlook. Display a list of training and their link to teams meetings

screenshot of the sample
screenshot of the sample

Display count-up and count-down buttons

Demonstrates a button with a number increasing by one and a button with a number decreasing by one. Also, this sample uses the setValue of customRowAction to update the field. You need to set the actionInput to the internal name of the column to be updated.

screenshot of the sample

Number Circle in Circle

This sample shows who the percentage value in a column can be displayed as the area of a circle within another circle.

screenshot of the sample

Background color shading by number column value

This sample demonstrates how to change the shade of the background color depending on the value of the number column. Also, in this sample, the background color is lightest at -100 and darkest at 350.

  • number-background-color-shading-theme-color.json uses your site’s theme color as the background color.
  • number-background-color-shading-custom-color.json uses the HTML color code as the background color, and in the sample, #FFBBFF is set.
screenshot of the sample

Reacting and displaying users who have reacted

Implement a like system on Sharepoint List elements or document library.

screenshot of the sample

Display users who have liked

This sample demonstrates showing the users who have liked an item.

screenshot of the sample

Monthly Emoji

This sample demonstrates how to display a emoji representing the month of the date to the left of the date.

screenshot of the sample

Update a Status (Choice) and a Person field using Buttons and the setValue action

This is a sample of creating buttons to approve/reject an item by updating an Approval Status field created using a choice field, and also set the value of a person field to the user who took the action by using the setValue action as below:

Sample in action

Wrap up

Again those samples are not done by me and are all available on github.

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

For more great content click here.

About the Author:

Has guided more than 50 clients in their digital transformation since 2008. Author of the blog www.collabmania.com. His articles are posted on sharepointeurope.com and collab365.com.

Co-organizer of aMs (Azure, Microsoft 365, SharePoint) Monaco and Nice.

His favorite project? Deliver an intranet for 8000 employees in Singapore, using the SCRUM methodology.

Reference:

Angama, J. (2017). SharePoint List and Microsoft List Column Formatting Options. Available at: https://www.collabmania.com/2017/12/03/sharepoint-online-column-formatting-options/ [Accessed: 20th December 2021].

Share this on...

Rate this Post:

Share: