Features
A deeper look at what the Document Manager can do.
Multi-Dataset Browsing
When the tool loads, it calls the Sanity Datasets API to discover every dataset in your project. A dropdown at the top of the toolbar lets you switch between them instantly. Changing datasets reloads the document list, resets filters, and clears selection state.
If you have a preferred dataset, use the defaultDataset option to pre-select it on load instead of defaulting to the first one alphabetically.
Full-Text Search
The search bar filters documents in real time as you type. It matches against four fields:
- title — the document's
titlefield - name — the document's
namefield (useful for singleton documents) - _id — the full document ID, including the
drafts.prefix - _type — the document type
Search is case-insensitive and happens entirely client-side.
Type Filtering
The Type dropdown is populated dynamically based on the document types found in the current dataset. Each option shows a count of how many documents match that type. Selecting a type scopes the table and search to that type only.
Use the excludeTypes config option to hide internal Sanity types (like sanity.imageAsset or sanity.fileAsset) from this dropdown.
Draft Toggle
The "Include drafts" checkbox controls whether documents with an _id starting with drafts. appear in the table. This is on by default. Turning it off is useful when you want to audit only published content.
Draft documents display an amber "draft" badge next to the type badge in the table for easy identification.
Bulk Selection & Deletion
Each row has a checkbox. Clicking anywhere on a row also toggles its selection. A "select all" checkbox in the table header toggles all documents on the current page.
The Delete button in the toolbar shows the current selection count. Clicking it opens a native confirmation dialog. If confirmed, the plugin builds a single Sanity transaction that deletes all selected documents atomically — either all succeed or none do.
After deletion, the affected rows are removed from the local list immediately and a success message appears. If anything fails, an error message is shown and no documents are removed.
Pagination
Documents are displayed in a paginated table. The default page size is 50, configurable via the pageSize option. Navigation buttons at the bottom let you move between pages.
Changing filters (type, search, draft toggle) resets pagination back to page 1 automatically.
Status Messages
The toolbar area displays contextual status messages after operations:
- Green — success messages (e.g., "Deleted 5 document(s)")
- Red — error messages (e.g., "Failed to load documents")