🗓️ Everything *[NYC] is back. A free gathering for AI builders. Sept 9

Dad Jokes widget

A dashboard widget for Sanity to make you laugh and cry at dad jokes

By Sachin Sancheti

Install command

npm i sanity-plugin-dashboard-dad-jokes

sanity-plugin-dashboard-dad-jokes

This is a Sanity Studio v4+ plugin (works on Studio v4, v5, and v6).

Why???

Who doesn't like jokes. A dad joke is lame enough to make you laugh and cry at the same time.

Sample Joke

What is happening in the background?

This widget takes dad jokes from https://icanhazdadjoke.com/

Installation

npm install sanity-plugin-dashboard-dad-jokes

This widget is rendered by @sanity/dashboard, which is a peer dependency. Install it too if you haven't already:

npm install @sanity/dashboard

Usage

Add dashboardTool to your plugins and pass jokesWidget() as one of its widgets in sanity.config.ts (or .js):

import {defineConfig} from 'sanity'
import {dashboardTool} from '@sanity/dashboard'
import {jokesWidget} from 'sanity-plugin-dashboard-dad-jokes'

export default defineConfig({
  // ...
  plugins: [
    dashboardTool({
      widgets: [jokesWidget()],
    }),
  ],
})

Size config

The widget size can be controlled using layout.width:

dashboardTool({
  widgets: [jokesWidget({layout: {width: 'small'}})],
})

Inspiration

I took inspiration from the Cats Widget official plugin of Sanity.

License

MIT © Sachin Sancheti

Develop & test

This plugin uses @sanity/plugin-kit with default configuration for build & watch scripts.

See Testing a plugin in Sanity Studio on how to run this plugin with hotreload in the studio.