Forum Discussion
MichelleARC
Oct 19, 2023Copper Contributor
Increase SharePoint 2019 column width with JSON
Is it possible to use JSON to increase the width of a document library column? If so, can you please share an example of that JSON? I'm trying to solve the problem of when a document library is add...
LeonPavesic
Oct 19, 2023Silver Contributor
Hi MichelleARC,
Certainly, here's a simplified explanation:
In SharePoint 2019, you can make the "Title" column wider by using a special code in JSON format. This is helpful if you want the full title to be visible without users needing to manually adjust the column width.
Here's an example of how you can do it:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"width": "300px" // You can change this to make the column wider
},
"children": [
{
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"href": "[$FileDirRef]/@currentField" // Adjust as needed
}
}
]
}
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- MichelleARCDec 14, 2023Copper ContributorThanks for the reply! When I add the code to the Title column, it doesn't save in the column. When I go back to view the column settings, the Json field is empty.