Configuration
The plugin works with zero configuration, but every aspect can be customized via plugin options.
Full example
sanity.config.ts
import { defineConfig } from 'sanity'
import { documentManager } from 'sanity-plugin-document-manager'
export default defineConfig({
plugins: [
documentManager({
// Custom tool title in the Studio navbar
title: 'Content Manager',
// Number of documents per page (default: 50)
pageSize: 100,
// Sanity API version (default: '2024-06-01')
apiVersion: '2024-06-01',
// Hide specific document types from the filter dropdown
excludeTypes: ['sanity.imageAsset', 'sanity.fileAsset'],
// Pre-select a dataset on load
defaultDataset: 'production',
}),
],
})Options reference
| Option | Type | Default | Description |
|---|---|---|---|
title | string | 'Document Manager' | Tool title in the Studio navbar. |
icon | ComponentType | DatabaseIcon | React component used as the tool icon. |
pageSize | number | 50 | Number of documents shown per page. |
apiVersion | string | '2024-06-01' | Sanity API version for GROQ queries. |
excludeTypes | string[] | [] | Document types hidden from the type dropdown. |
defaultDataset | string | — | Pre-select a specific dataset on load. |
Environment variables
The plugin reads the Sanity write token from your environment. It checks these variables in order:
SANITY_STUDIO_WRITE_TOKEN(recommended for Sanity Studio)NEXT_PUBLIC_SANITY_WRITE_TOKEN(fallback for Next.js setups)
The token needs read + write access so it can both query documents and perform bulk deletions.