👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Difficulty creating a Dashboard Widget in Sanity

1 replies
Last updated: Sep 7, 2020
Hi. I’m having difficulties creating my first Dashboard Widget using the process described in the Sanity documentation — https://www.sanity.io/docs/creating-your-own-widget I have been able to install all the reference widgets like dashboard-widget-cats and dashboard-widget-document-list with no problem or issues, but when I create my new widget using the cats one as baseline, I went through all the steps of renaming, but I still get the error of:
Not found: “cats2”
Make sure your 
sanity.json
 file mentions such a widget and that it’s an implementation of 
part:@sanity/dashboard/widget
.
My root
sanity.json
has “cats2" noted in the “plugins” area.
My plugin
sanity.json
(located in plugins/cats2/) has the following:
{
  "parts": [
    {
      "name": "part:@sanity/dashboard/widget/cats2",
      "implements": "part:@sanity/dashboard/widget",
      "path": "index.js"
    }
  ]
}
My
dashboardConfig.js
has this cited for my widget:
{
   name: 'cats2'
},
I just can’t figure out if there is another place that “cats2” will need to be noted. Or any other place that I would need to allow for customs widgets? Any help would be super appreciated. Thanks!
Sep 7, 2020, 3:25 AM
Huzzah! I found the culprit. I didn’t realize that
name
was also present within the
index.js
file at the very bottom. In using the cat2 example, I had to change that to:

export default {
  name: 'cats2',
  component: Cats
}

Sep 7, 2020, 7:08 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?