
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeFor creating working links to document edit screens in Sanity Studio v2 from custom document views, you'll want to use the IntentLink component rather than plain relative links. This is the proper way to navigate within the Studio without causing full page refreshes or unresponsive behavior.
The IntentLink component from part:@sanity/base/router handles Studio navigation properly by working with the internal state management system. Here's how to use it:
import { IntentLink } from 'part:@sanity/base/router'
// In your component
<IntentLink
intent="edit"
params={{ id: documentId, type: documentType }}
>
Click to edit
</IntentLink>This generates URLs that look like:
http://localhost:3333/intent/edit/id=4497efe3-8ab6-4e55-872e-b1ef9577cc07;type=paletteColor/
When you use regular <a> tags with relative paths like /desk/paletteColor-unsorted;d27d5d4e-5faf-4a4c-b25f-0213e2ea492c, the browser treats it as a full page navigation. This causes:
The Studio maintains complex state for the desk structure, panes, and document editing sessions. IntentLink preserves all of this by using the internal router.
Here's a more complete example showing IntentLink in context:
import React from 'react'
import { IntentLink } from 'part:@sanity/base/router'
import Preview from 'part:@sanity/base/preview'
import schema from 'part:@sanity/base/schema'
const MyCustomView = ({ documents }) => {
return (
<div>
{documents.map((doc) => {
const schemaType = schema.get(doc._type)
return (
<IntentLink
key={doc._id}
intent="edit"
params={{ id: doc._id, type: doc._type }}
>
<Preview value={doc} type={schemaType} />
</IntentLink>
)
})}
</div>
)
}This pattern is used throughout Sanity's own components (like in the backlinks recipe) and provides smooth, stateful navigation within the Studio.
Note: If you've migrated to Studio v3, the approach has changed - you'd use the router from sanity/router instead. But for v2, IntentLink is the way to go!
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