Where is SanityPreview component in Sanity v3?
I need to be honest - I couldn't find specific documentation about the direct replacement for SanityPreview from @sanity/base/preview in Studio v3. This is a common pain point during migration since the component was widely used in v2.
What I can confirm is that Studio v3 deprecated the entire Parts System, which means all @sanity/base/* imports no longer exist. Everything moved to the main sanity package with JavaScript-based configuration.
Here's what I'd recommend:
For rendering previews in custom tools/plugins in v3, you have a few approaches:
Use Sanity UI components directly - Build your preview UI using
@sanity/uicomponents and fetch the data you need through hooks or the clientCheck the
sanitypackage exports - There may be a preview component exported from the main package, but I cannot verify the exact API without access to the current type definitionsUse preview functionality from Structure Builder - If you're building custom views, the Component View system might provide what you need
My strong recommendation: Post this question in the Sanity Community Slack or check the official v2 to v3 migration guide. The Sanity team is very responsive to migration questions and can point you to the exact replacement component and its API.
Since you're porting a custom tool, the team can also advise on whether the v3 plugin architecture has better patterns for what you're trying to accomplish. The v3 plugin API is significantly different, so there might be a more idiomatic approach than directly replacing the component.
Sorry I couldn't provide the exact code replacement - I'd rather point you to verified sources than give you something that might not work!
Show original thread9 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.