Difficulty creating a Dashboard Widget in Sanity
I can see you're working with Sanity Studio v2 (based on the sanity.json and parts system you're referencing). The issue you're experiencing is a common configuration problem when creating custom dashboard widgets in v2.
Based on your setup, the problem is likely in your dashboardConfig.js. When you reference a custom widget, you need to use the full part name, not just the short name.
In your dashboardConfig.js, change this:
{
name: 'cats2'
}To this:
{
name: 'part:@sanity/dashboard/widget/cats2'
}The widget configuration needs to reference the complete part name that you defined in your plugin's sanity.json file. The built-in widgets (like the document-list widget) have shorthand names that are pre-registered, but custom widgets need the full part path.
Your plugin structure looks correct otherwise:
- ✅ Root
sanity.jsonlists "cats2" in plugins array - ✅ Plugin
sanity.jsonatplugins/cats2/sanity.jsondefines the part correctly - ✅ The part implements
part:@sanity/dashboard/widget - ✅ Path points to
index.js
Additional things to verify:
- Make sure your
plugins/cats2/index.jsfile exists and exports a valid widget component - Restart your development server after making these changes
- Check that your root
sanity.jsonhas the dashboard plugin installed:
{
"plugins": [
"@sanity/dashboard",
"cats2"
]
}Note about Studio versions: If you're starting a new project, be aware that Sanity Studio v3 (the current version) uses a completely different configuration system without sanity.json or the parts system. The dashboard plugin and custom widgets work differently in v3, using standard JavaScript/TypeScript modules and the new configuration format. According to the dashboard GitHub repository, v3 widgets are configured by importing widget functions directly and passing configuration as function arguments rather than using the parts system. If you have flexibility in your project, you might want to consider using Studio v3, which has a more straightforward plugin architecture.
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.