defaultLayout
- Type:
'default' | 'card' | 'media' | 'detail' | 'block' | ((params: CallbackParams & { childOptions: ChildResolverOptions }) => 'default' | 'card' | 'media' | 'detail' | 'block') - Optional: Yes
The defaultLayout property specifies the default layout style for documents listed in the desk menu.
Standard Usage
ts
{
title: 'Media Gallery',
schemaType: 'mediaItem',
defaultLayout: 'media',
}ts
helpers.listing('mediaItem', {
title: 'Media Gallery',
defaultLayout: 'media',
});Dynamic Layout (Callback)
You can dynamically switch layout style using a callback function based on the active desk context.
ts
{
title: 'Portfolio Items',
schemaType: 'portfolio',
defaultLayout: ({ workspace }) => (workspace === 'creative' ? 'media' : 'default'),
}ts
helpers.listing('portfolio', {
title: 'Portfolio Items',
defaultLayout: ({ workspace }) => (workspace === 'creative' ? 'media' : 'default'),
});