How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Where is SanityPreview component in Sanity v3?

9 repliesLast updated: Dec 1, 2025

HiI'm trying to port a custom tool from v2 to v3, and it uses the
<SanityPreview>
component. Where do I get this from in v3?

import React from "react";
import { SanityPreview } from "@sanity/base/preview";
import { Card, Box } from "@sanity/ui";

export default ({document, schemaType,})=&gt;{
  const documentId = document._id;

  return (
    &lt;Box paddingX={2} as="li"&gt;
      &lt;Card
        state={{ selectedDocumentId: documentId }}
        padding={2}
        radius={2}
      &gt;
        &lt;SanityPreview layout="default" value={document} type={schemaType} /&gt;
      &lt;/Card&gt;
    &lt;/Box&gt;
  );
}
AI Update

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:

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 thread
9 replies

Was this answer helpful?

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.

Related contributions