schemaType
- Type:
string | ((params: CallbackParams) => string) - Optional: Yes
The schemaType property links the list item to a specific document type defined in your Sanity schema.
Standard Usage
ts
{
schemaType: 'author',
}ts
helpers.listing('author');With Custom Title
By default, the plugin generates a title based on the schemaType. You can override it using the title property.
ts
{
title: 'Contributors',
schemaType: 'author',
}ts
helpers.listing('author', {
title: 'Contributors',
});With Custom Icon
ts
import { UsersIcon } from '@sanity/icons';
{
schemaType: 'author',
icon: UsersIcon,
}ts
import { UsersIcon } from '@sanity/icons';
helpers.listing('author', {
icon: UsersIcon,
});With Combined (Title + Icon)
ts
import { UsersIcon } from '@sanity/icons';
{
title: 'Contributors',
schemaType: 'author',
icon: UsersIcon,
}ts
import { UsersIcon } from '@sanity/icons';
helpers.listing('author', {
title: 'Contributors',
icon: UsersIcon,
});With Disabled Pluralization
Use isPlural: false to display the singular name as defined in your schema.
ts
{
schemaType: 'author',
isPlural: false,
}ts
helpers.listing('author', {
isPlural: false,
});Dynamic Schema Type (Callback)
You can set the schemaType dynamically using a callback function:
ts
{
schemaType: ({ workspace }) => workspace === 'blog' ? 'post' : 'product',
}ts
helpers.listing(({ workspace }) => (workspace === 'blog' ? 'post' : 'product'));