SharePoint Column Formatting – customize the look of Hyperlink columns and their Display Text

1+

There is nothing wrong with how SharePoint Hyperlink columns display information by default. However, some users believe that the look is too generic, hard to bring attention to, which I myself tend to agree with.

Let’s see how it looks by default:

The issues in my opinion are:

  • the Display Text is grey and no different than any other column
  • if Display Text needs to always be the same (e.g. CLICK HERE), then it has to be typed in that way in every single list item.

We will address both issues.


1. KEEP THE ORIGINAL DISPLAY TEXT AND CHANGE THE LOOK

The following JSON code is applied to both Hyperlink columns:

{
	"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
	"elmType": "a",
	"txtContent": "@currentField.desc",
	"style": {
		"color": "red",
		"font-weight": "bold"
	},
	"attributes": {
		"target": "_blank",
		"href": "@currentField"
	}
}


2. SHOW PREDEFINED DISPLAY TEXT AND CHANGE THE LOOK

The following JSON code is applied to both Hyperlink columns:

{
	"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
	"elmType": "a",
	"txtContent": "CLICK HERE",
	"style": {
		"color": "blue",
		"font-weight": "bold"
	},
	"attributes": {
		"target": "_blank",
		"href": "@currentField"
	}
}

1+

Leave a Reply

Close Menu