👀 See Sanity in action: Watch product demo now →

How to Hide the "Create New Document" Button

3 replies
Last updated: Apr 16, 2021
Hi All, I have created a very stripped down form of the backend for a client, they only have a few specific pages that they will be editing, and there are no document types for them to add at this point. I am wondering if there is a way for me to hide the "Create new Document" button from the top nav bar?
Apr 16, 2021, 4:19 AM
There was some discussion about this recently and I think the general consensus was to use CSS to remove it. Something like this should work:

[class^="Navbar_createButton"] {
  display: none
}
If you want to remove the functionality—the ability to create new documents—you could add something like this in sanity.json (the
name
matters, but the
path
and where you put the file doesn’t):

"parts": [
  {
    "name": "part:@sanity/base/initial-value-templates",
    "path": "./plugins/initial-value-templates/initialValueTemplates.js"
  }
]
Then in
initialValueTemplates.js
, put:

export default []
Apr 16, 2021, 5:27 AM
Awesome! thanks for the help
user A
and
user L
!
Apr 16, 2021, 5:37 AM

Sanity.io – build remarkable experiences at scale

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

Categorized in