
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYou're looking for an array of objects approach - this is exactly what Sanity calls a "page builder" or "flexible content" pattern! It's a super common setup and doesn't require a rich text editor at all.
Here's how to set it up:
Create an array field with multiple object types that editors can choose from. Here's a simple example:
{
name: 'content',
type: 'array',
title: 'Page Content',
of: [
{
name: 'hero',
type: 'object',
title: 'Hero Section',
fields: [
{ name: 'heading', type: 'string' },
{ name: 'tagline', type: 'text' },
{ name: 'image', type: 'image' }
]
},
{
name: 'textBlock',
type: 'object',
title: 'Text Block',
fields: [
{ name: 'title', type: 'string' },
{ name: 'content', type: 'text' }
]
},
{
name: 'gallery',
type: 'object',
title: 'Image Gallery',
fields: [
{ name: 'images', type: 'array', of: [{ type: 'image' }] }
]
}
]
}If you're using TypeScript, use defineField and defineArrayMember for better type safety:
defineField({
name: 'content',
type: 'array',
title: 'Page Content',
of: [
defineArrayMember({
name: 'hero',
type: 'object',
title: 'Hero Section',
fields: [
defineField({ name: 'heading', type: 'string' }),
defineField({ name: 'tagline', type: 'text' }),
defineField({ name: 'image', type: 'image' })
]
}),
defineArrayMember({
name: 'textBlock',
type: 'object',
title: 'Text Block',
fields: [
defineField({ name: 'title', type: 'string' }),
defineField({ name: 'content', type: 'text' })
]
})
]
})This approach gives you:
You can enhance the editing experience by adding custom previews to your blocks so editors can see what each block contains without opening it:
{
name: 'hero',
type: 'object',
preview: {
select: {
title: 'heading',
media: 'image'
}
},
fields: [...]
}Sanity actually has a full course on page building that covers this pattern in depth, including best practices and advanced techniques. The core concept is that at its fundamental level, a page builder is just an array of objects - exactly what you're describing!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store