🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Creating your own widget

How to create and publish your own widget for Dashboard

Widgets are simply objects that follow implement the DashboardWidget interface. Let's have a look at some sample widgets:

For example, a document list or maybe some cats?


The easiest way to package your widget for distribution is to wrap it in a plugin! To get started making your own plugins for Sanity Studio, check out this article on developing plugins.

When writing your widget components, it's recommended to use the DashboardWidgetContainer component from this package by importing it like so: import { DashboardWidgetContainer } from "@sanity/dashboard";.

This gives you a typical widget component structure with basic styles, and the option of presenting your content in the header, footer, or body of the widget.

If you need something more flexible you can create your own component.

Setting up the widget with the default setup will give you a basic widget that looks something like this:

  header="A cat"
    <Flex direction="column" align="stretch">
        text="Get new cat"
    <img src="https://placekitten.com/300/450" />

You can study the source code of these widgets to get a sense of how you can approach fetching documents, adding configuration, and so on:

Was this article helpful?