The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
Hi Mote Jeffery
Thank you for reaching out to Microsoft Q&A forum
As states in Gallery layout customizations, gallery (card/grid) layout is rendered by the view formatter (tile-formatting), not by the per-column cell renderer, so a column-formatting rule like style.visibility (or style.display) can be ignored once the same field is being drawn inside a Gallery card.
Given this, to resolve this behavior, you have 2 options below:
Option 1: Move the hide/show logic into Gallery view formatting (tile-formatting)
- Switch to your Gallery view.
- Select View options → Format current view → Advanced mode.
- Use tile-formatting JSON and conditionally set display to
nonewhen you want it hidden
For example:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
"height": 110,
"width": 220,
"hideSelection": true,
"formatter": {
"elmType": "div",
"style": { "padding": "8px" },
"children": [
{
"elmType": "button",
"txtContent": "Follow-up",
"style": {
"display": "=if([$DueDate] < @now, 'inline-block', 'none')",
"border": "none",
"background-color": "#0078d4",
"color": "white",
"cursor": "pointer",
"padding": "6px 10px",
"border-radius": "2px"
}
}
]
}
}
Option 2: Reuse your existing column-formatted button inside Gallery using columnFormatterReference
If you want to keep your current column formatting (so List view keeps working), then in Gallery view formatting you can “embed” that formatted column by referencing it with columnFormatterReference.
- The wrapper
divdecides whether the element is shown. -
columnFormatterReferenceinjects whatever your Status column formatter renders (your button).
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
"height": 110,
"width": 220,
"formatter": {
"elmType": "div",
"style": { "padding": "8px" },
"children": [
{
"elmType": "div",
"style": { "display": "=if([$DueDate] < @now, '', 'none')" },
"children": [
{ "columnFormatterReference": "[$Status]" }
]
}
]
}
}
Hope my answer will help you.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.