
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a common issue with @sanity/ui that's typically caused by mismatched versions between your Studio and plugins. Based on the community discussion about this exact problem, here's how to fix it:
When developing custom plugins, if @sanity/ui is installed as a regular dependency in your plugin (rather than a peer dependency), it can create conflicts with the version your Studio uses. This leads to theme crashes when the plugin components are rendered.
1. Clear everything and reinstall:
# In both your Studio and plugin directories
rm -rf node_modules package-lock.json # or pnpm-lock.yaml if using pnpm
npm install # or pnpm install2. If developing a custom plugin, ensure @sanity/ui is listed as a peer dependency, not a regular dependency:
// In your plugin's package.json
{
"peerDependencies": {
"@sanity/ui": "^2.0.0",
"react": "^18",
"react-dom": "^18",
"styled-components": "^6.1"
}
}3. Make sure your Studio has the required peer dependencies installed:
npm install @sanity/ui styled-components react react-domIf you're linking plugins with pnpm, make sure you're using pnpm link correctly. The community thread mentions this can sometimes cause issues - you might want to try using yalc instead for local plugin development.
@sanity/ui@2.0.7 should work fine with styled-components@6.1.8 - these versions are compatible according to the Sanity UI documentation.
From the community thread, the issue was eventually resolved by starting fresh with a clean project setup. If you're still stuck:
@sanity/ui components that aren't being used@sanity/uiThe key takeaway: never install @sanity/ui as a regular dependency in your plugin - it should always be a peer dependency to avoid version conflicts with the Studio.
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