Forum Discussion
amccormack
Microsoft
Sep 01, 2022SharePoint - Wrap text in gallery view
Hi All,
Been scouring a while now looking for an answer. I've seen a lot of posts about this but cannot get anything to work. I am trying to get the 'new title' column to wrap the text so the e...
ganeshsanap
Sep 02, 2022MVP
amccormack You need to use the view formatting instead of column formatting.
As you are using tile/gallery list view, you have to customize the "Gallery" view:
- Go to list
- Click on "Switch view options" dropdown (where you select list view) from top right corner
- Select "Format current view"
- Select "Gallery" under "Choose Layout" dropdown
- Click on Advanced mode
- Find the code for Title column in existing JSON
- Make changes in the JSON & Save
Follow documentation for more information: view-gallery-formatting
Similar thread for more information: (SP List) How to wrap a text in the format view?
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.
amccormack
Microsoft
Sep 02, 2022Unfortunately, that didn't work. But I will check out the documentation you shared and see if I can come up with something. Thanks for the help.
- baklineAug 09, 2023Copper Contributor
amccormack did you ever figure it out? Having the exact same problem. Nothing works. The json editor keeps saying it’s not valid code and won’t even save in sharepoint online.
- ALOE_2023Mar 12, 2024Copper Contributor
bakline amccormack I was able to get the title to wrap using a combo of white-space and word-break. I think what was key was placing the code below "txtContent."
"elmType": "p", "attributes": { "title": "[$Title]", "class": "ms-fontColor-neutralPrimary sp-card-content sp-card-highlightedContent", "role": "heading", "aria-level": "3" }, "txtContent": "=if ([$Title] == '', '–', [$Title])", "style":{ "white-space": "wrap", "word-break": "keep-all"}
Here is how this looks in practice:
- kskyllingmarkApr 30, 2024Copper ContributorHow to get text to wrap in the column headers also?