Change the “New item” text in Modern SharePoint Online List Form
Requirement: Change the “New Item” text in a modern SharePoint Online list.
How to change the New item text in SharePoint Online?
By default, when you create a new item in SharePoint Online lists, the New item panel has “New Item” as the pane’s title. What if you want to change this text to something relevant? E.g. On the “Projects” list, wouldn’t it be nice to display “Create new Project” instead of “New Item”? Well, here are the steps to change the new item pane’s caption by formatting the List form layout:
- Navigate to your modern SharePoint Online list >> Click on “New”. This opens the New Item Panel in the modern list.
- In the New Item pane, Click on the “Edit Form” drop-down and choose “Configure Layout”.
- In the “Apply formatting to” drop-down, choose “Header” and then enter the below JSON code in “Formatting code”.
{
"elmType": "div",
"style": {
"font-size": "18px",
"font-weight": "600"
},
"txtContent": "Create New Project"
}
Preview and save your changes. This sets the list form layout to the given JSON formatting. More on list form formatting: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-configuration
PnP PowerShell to Configure New Item Form Layout
Use this PowerShell to set the layout JSON for new item form in a SharePoint Online list:
#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/PMO"
$ListName="Projects"
$JSON = @"
{
"headerJSONFormatter":
{
"elmType": "div",
"style": {
"font-size": "18px",
"font-weight": "600"
},
"txtContent": "Create New Project"
}
}
"@
#Connect to the site
Connect-PnPOnline -Url $SiteURL -Interactive
#Apply JSON Formatting to the content type
$ContentType = Get-PnPContentType -Identity "Item" -List $ListName
$ContentType.ClientFormCustomFormatter = $JSON
$ContentType.Update($False)
Invoke-PnPQuery
I have used the “headerJSONFormatter” property here. Similarly, you can use “footerJSONFormatter” or “bodyJSONFormatter” properties too. Here are some of the samples from the community: https://github.com/pnp/List-Formatting/tree/master/form-samples
After saving the layout, the menu looks modified. However, if you go back to the main list view and click “New”, the view is back to how it was before.
Try clearing the Cache/Cookies or use a Different Browser like Edge.