I have a list in SPO with a Choice column (Video, Word, PDF). I would like to display an icon in a column called FileType
.
I have tried to customize the JSON of the FileType
Column but it just shows the text.
Any ideas?
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"box-sizing": "border-box",
"padding": "0 2px",
"overflow": "hidden",
"text-overflow": "ellipsis"
},
"attributes": {
"class": "sp-css-backgroundColor-BgLightGray sp-field-fontSizeSmall sp-css-color-LightGrayFont"
},
"txtContent": "=if([$FileType] == 'Video', 'MSNVideos', if([$FileType] == 'Word', 'WordDocument', if([$FileType] == 'PDF', 'PDF','')))"
}
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "iconName": "=if([$FileType] == 'PDF', 'PDF', if([$FileType] == 'Video', 'MSNVideos', if([$FileType] == 'Word', 'WordDocument')))" }, "style": { "font-size": "24px", "color": "black" } }