title
- Type:
string | TitleObject | ((params: CallbackParams) => string | TitleObject) - Optional: Yes (Required if
childrenis present)
The title property sets the display name for the list item in the Sanity desk menu.
Standard Usage
ts
{
title: 'My Custom Title',
schemaType: 'author',
}ts
helpers.listing('author', {
title: 'My Custom Title',
});Parent & Child Titles
You can specify a different title for when an item is listed in the parent list versus when it is opened as a child pane. This is done by passing a TitleObject containing parent and/or child keys.
ts
{
schemaType: 'author',
title: {
parent: 'Contributors',
child: 'Authors',
},
}ts
helpers.listing('author', {
title: {
parent: 'Contributors',
child: 'Authors',
},
});With Children
When children are present, title becomes mandatory to label the parent item in the desk menu.
ts
{
title: 'Profile',
children: [
{
schemaType: 'author',
},
{
schemaType: 'user',
},
],
}ts
helpers.children('Profile', [helpers.listing('author'), helpers.listing('user')]);With Dividers
You can use the title property with helpers.divider to create a labeled separator.
ts
{
title: 'Content Section',
isDivider: true,
}ts
helpers.divider('Content Section');Dynamic Title (Callback)
You can set the title dynamically using a callback function:
ts
{
title: ({ workspace }) => `${workspace === 'production' ? 'Live' : 'Staging'} Settings`,
schemaType: 'settings',
singleton: true,
}ts
helpers.singleton('settings', {
title: ({ workspace }) => `${workspace === 'production' ? 'Live' : 'Staging'} Settings`,
});