
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes! You absolutely can insert inline elements in Sanity's Portable Text Editor, just like those dinos in the ProseMirror example you linked to.
While you might be familiar with adding block-level custom content (like images) by including them in the of array alongside type: 'block', inline objects work differently. You add them as an of property inside the block definition itself.
Here's a simple example with an inline author reference:
import { defineType } from 'sanity'
export default defineType({
name: 'blockContent',
type: 'array',
of: [
{
type: 'block',
of: [ // This 'of' array defines inline objects!
{
name: 'authorReference',
type: 'reference',
to: [{type: 'author'}]
}
]
}
]
})This creates an inline reference that appears in your text flow, not as a separate block. When you click the "Reference to author" button in the toolbar, it opens a modal (similar to how annotations work), and the reference gets embedded right in the text.
The key difference from annotations is that inline objects appear directly in the children array alongside your text spans:
"children": [
{
"_type": "span",
"text": "This is how an inline reference to an author, "
},
{
"_type": "authorReference",
"_ref": "9b8382ae-69f7-4161-a0e2-e8a86b15d616"
},
{
"_type": "span",
"text": ", would look like."
}
]When querying, you'll need to resolve these inline references in your GROQ queries:
*[_type == 'post']{
...,
content[]{
_type == 'block' => {
...,
children[]{
...,
_type == 'authorReference' => {
...,
"authorName": @->.name
}
}
}
}
}This is perfect for things like:
Check out the official guide on adding inline blocks to Portable Text and the block type documentation for more details on implementing this pattern!
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