Forum Discussion
JSON Header Formatting SharePoint list - Subheading
- May 15, 2024
ConnM yes you can do this but it can't pick up the list description so you will need to have a column in your list for the subtitle text. But the advantage of that is that the text can then be different for each item. My column for the subtitle is called Note.
{ "elmType": "div", "attributes": { "class": "ms-bgColor-themePrimary ms-fontColor-white" }, "children": [ { "elmType": "div", "style": { "margin": "10px", "width": "100%", "border": "none", "padding": "10px", "display": "=if([$Title] == '' , 'none' , 'flex')", "flex-direction": "column" }, "children": [ { "elmType": "div", "txtContent": "[$Title]", "style": { "text-align": "left" }, "attributes": { "class": "ms-fontSize-28 ms-fontWeight-bold" } }, { "elmType": "div", "txtContent": "[$Note]", "style": { "text-align": "left", "display": "=if([$Note] == '' , 'none' , '')" }, "attributes": { "class": "ms-fontSize-16" } } ] } ] }
This is the result:
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
ConnM yes you can do this but it can't pick up the list description so you will need to have a column in your list for the subtitle text. But the advantage of that is that the text can then be different for each item. My column for the subtitle is called Note.
{
"elmType": "div",
"attributes": {
"class": "ms-bgColor-themePrimary ms-fontColor-white"
},
"children": [
{
"elmType": "div",
"style": {
"margin": "10px",
"width": "100%",
"border": "none",
"padding": "10px",
"display": "=if([$Title] == '' , 'none' , 'flex')",
"flex-direction": "column"
},
"children": [
{
"elmType": "div",
"txtContent": "[$Title]",
"style": {
"text-align": "left"
},
"attributes": {
"class": "ms-fontSize-28 ms-fontWeight-bold"
}
},
{
"elmType": "div",
"txtContent": "[$Note]",
"style": {
"text-align": "left",
"display": "=if([$Note] == '' , 'none' , '')"
},
"attributes": {
"class": "ms-fontSize-16"
}
}
]
}
]
}
This is the result:
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
Thanks Rob_Elliott,
I used your response as a bit of a template. I didn't need the dynamic text, so I hardcoded it in and it seems to be working. I really appreciate it
{
"elmType": "div",
"attributes": {
"class": "ms-bgColor-green ms-fontColor-white ms-borderColor-Green"
},
"children": [
{
"elmType": "div",
"style": {
"margin": "10px",
"width": "100%",
"border": "none",
"padding": "10px",
"flex-direction": "column"
},
"children": [
{
"elmType": "div",
"txtContent": "= [$Title] + ' PID '",
"style": {
"text-align": "left"
},
"attributes": {
"class": "ms-fontSize-28 ms-fontWeight-bold"
}
},
{
"elmType": "div",
"txtContent": "Confidential",
"style": {
"text-align": "right"
},
"attributes": {
"class": "ms-fontSize-12"
}
}
]
}
]
}