
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, there is a way to create a plugin with a button in the navbar that opens a modal without navigating to a new route! The Studio Components API allows you to customize various parts of the Studio UI, including the navbar.
According to the Studio Components Reference, you can override the navbar component to add custom elements. Here's how you can approach this:
You can use the studio.components.navbar configuration to render custom components alongside the default navbar:
// ./sanity.config.tsx
import {defineConfig, NavbarProps} from 'sanity'
import {Button, Dialog} from '@sanity/ui'
import {useState} from 'react'
function CustomNavbar(props: NavbarProps) {
const [isOpen, setIsOpen] = useState(false)
return (
<>
{props.renderDefault(props)} {/* Render the default navbar */}
{/* Your custom button */}
<Button
onClick={() => setIsOpen(true)}
text="Open Modal"
tone="primary"
/>
{/* Your modal */}
{isOpen && (
<Dialog
header="My Custom Modal"
id="custom-modal"
onClose={() => setIsOpen(false)}
width={1}
>
{/* Your modal content here */}
<div>Modal content goes here!</div>
</Dialog>
)}
</>
)
}
export default defineConfig({
// rest of config ...
studio: {
components: {
navbar: CustomNavbar,
}
}
})renderDefault(props) renders the standard navbar, so you're extending rather than replacing itDialog, Button, etc. for consistency with the Studio's designThe {/* Insert plugins here */} comment you found in the source is likely a placeholder for future extension points, but the navbar component override is the official way to achieve what you're looking for. This approach gives you full control over adding interactive elements to the navbar without creating a separate tool route.
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