Group Header with Count
Overview
- Shows the item count for each group inside its header as a clean pill
- The header names the grouped column and its value for clear context
- The count comes straight from SharePoint, so it is always accurate
- The collapse and expand behavior stays native to SharePoint grouping
- Applied as view formatting JSON on the group header, so it changes nothing about the rows or the data
- Works on any grouped column without editing
Common Use Cases
- Tickets grouped by status with counts
- Tasks grouped by stage
- Items grouped by category
- Requests grouped by priority
- Records grouped by owner
- Any grouped list where counts matter
Details
- Design Pattern: Grouped Views
- Format Scope: View
Required Columns
| Display name | Column type | Internal name |
|---|---|---|
| Title | Single line of text | [Title] |
| Status | Choice | [Status] |
| Assigned To | Person or Group | [AssignedTo] |
Prerequisites
- Build a list with these columns before you paste the JSON.
- Populate the list with data.
- Group the view first – the JSON does not create the groups by itself. Set the view’s Group by to the grouping column and save before formatting.
- No separate Count column is required; SharePoint supplies the live count. Apply the JSON under Format current view, not Format this column.
How to Apply JSON code
- Group the view by Status (open the Status column header menu and choose Group by Status, or set it under view settings).
- Open the view dropdown at the top right and choose Format current view.
- Switch to Advanced mode, paste the JSON below, and click Save.
JSON Code
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/view-formatting.schema.json",
"groupProps": {
"headerFormatter": {
"elmType": "div",
"style": {
"display": "flex",
"align-items": "center",
"padding": "6px 4px"
},
"children": [
{
"elmType": "div",
"style": {
"width": "180px",
"min-width": "180px",
"max-width": "180px",
"font-size": "17px",
"font-weight": "600",
"color": "#201f1e",
"white-space": "nowrap",
"overflow": "hidden",
"text-overflow": "ellipsis"
},
"txtContent": "=@group.columnDisplayName + ': ' + @group.fieldData"
},
{
"elmType": "div",
"style": {
"margin-left": "10px",
"padding": "4px 14px",
"min-width": "60px",
"text-align": "center",
"border-radius": "13px",
"background-color": "#e3e6ea",
"color": "#323130",
"font-size": "14px",
"font-weight": "600",
"white-space": "nowrap"
},
"txtContent": "=@group.count + if(@group.count == 1, ' item', ' items')"
}
]
}
}
}
Common Questions About the Group Header with Count
What is the Group Header with Count built with?
It is built with a standard Microsoft List (SharePoint list) and view formatting JSON applied to the group header. There is no custom development, no SPFx solution, and no third-party tools. It is the kind of clean, maintainable formatting Greg Zelfond builds for teams that want clearer grouped views without ongoing development overhead.
Where does the count come from?
SharePoint provides the number of items in each group, and the JSON simply places that number in the header as a pill. Because it comes from SharePoint, the count stays correct as items are added, moved, or removed.
Does this change how grouping works?
No. SharePoint still does the grouping and the collapse and expand. The JSON only adds the count and tidies the header, so all the normal grouped-view behavior stays the same.
Does this design use any custom development or third-party tools?
No. It uses only out-of-the-box SharePoint view formatting, which Microsoft supports natively. That keeps it stable and easy to maintain, and nothing breaks when SharePoint is updated. Out-of-the-box is the only way Greg builds, so you can own and extend the design yourself for years.
If LookBook 365 is code-free and out-of-the-box, why does this example include JSON?
Because SharePoint formatting JSON is not custom code – it is a native configuration feature built into lists and libraries. It is declarative: it only describes how existing columns and views look, and cannot run scripts, reach external services, or change your data. Nothing is deployed and nothing breaks when Microsoft updates SharePoint, and you can edit or remove it anytime. That is why LookBook 365 treats it as out-of-the-box and low risk.
Can Greg build a view like this for our team?
Yes – this is exactly the kind of work Greg Zelfond does. As an independent SharePoint consultant and Microsoft MVP, he designs out-of-the-box list and library formatting like this so your team can read and maintain it without a developer. Reach out through the contact page to talk about your lists.
