Sanity equivalent to ACF Flexible Content or Prismic Slices?
Yes! Sanity has a built-in equivalent to ACF's Flexible Content and Prismic's Slices, and it's actually one of the platform's core strengths. You'll use array fields with multiple object types to achieve this.
The Short Answer
In Sanity, you create an array field with an of property that defines which block types can be added. Here's a quick example matching your use case (quote, hero image, carousel):
{
name: 'pageBuilder',
title: 'Page Builder',
type: 'array',
of: [
{ type: 'hero' },
{ type: 'quote' },
{ type: 'carousel' }
]
}Each of those types (hero, quote, carousel) would be defined as separate object types in your schema with their own fields. Content editors can then add, reorder, and remove these blocks just like in ACF or Prismic.
How It Works
Sanity calls this pattern a Page Builder, and at its core, it's an array of objects. The array field type supports multiple member types through the of property, which is exactly what you need for flexible content.
The key advantages over ACF/Prismic:
- Drag-and-drop reordering built-in
- Copy/paste support for entire arrays or individual blocks
- Type-safe if you're using TypeScript
- Highly customizable - you can add custom previews, validation, and interactive components
Full Example
Here's a more complete implementation:
// Define your block types
const hero = {
name: 'hero',
title: 'Hero Section',
type: 'object',
fields: [
{ name: 'heading', type: 'string' },
{ name: 'image', type: 'image' },
{ name: 'cta', type: 'string' }
]
}
const quote = {
name: 'quote',
title: 'Quote Block',
type: 'object',
fields: [
{ name: 'text', type: 'text' },
{ name: 'author', type: 'string' }
]
}
const carousel = {
name: 'carousel',
title: 'Image Carousel',
type: 'object',
fields: [
{
name: 'images',
type: 'array',
of: [{ type: 'image' }]
}
]
}
// Add to your page document
{
name: 'page',
type: 'document',
fields: [
{ name: 'title', type: 'string' },
{
name: 'content',
title: 'Page Content',
type: 'array',
of: [
{ type: 'hero' },
{ type: 'quote' },
{ type: 'carousel' }
]
}
]
}Why This Approach is Powerful
Unlike ACF where flexible content is an add-on concept, Sanity's array fields are a fundamental schema type with first-class support. This means:
- Better authoring experience - Content editors get visual previews of each block type
- Reusability - You can use references instead of objects if you want blocks shared across pages
- Flexibility - Mix objects, references, and even rich text blocks in the same array
- No plugin required - This is core functionality, not a premium add-on
The Page Builder course has a full walkthrough on implementing this pattern with best practices around modeling for meaning rather than presentation. There's also a great guide on using structured content for page building that covers the architectural decisions you'll want to consider.
Welcome to the Sanity community! π
Show original thread2 replies
Sanity β Build the way you think, not the way your CMS thinks
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.