Sanity Library Reference Docs
    Preparing search index...

    Interface DocumentPluginOptionsBeta

    interface DocumentPluginOptions {
        actions?: DocumentActionComponent[] | DocumentActionsResolver;
        askToEdit?: {
            enabled:
                | boolean
                | ((context: DocumentAskToEditEnabledContext) => boolean);
        };
        badges?: DocumentBadgeComponent[]
        | DocumentBadgesResolver;
        drafts?: { enabled?: boolean };
        inspectors?: DocumentInspector[] | DocumentInspectorsResolver;
        newDocumentOptions?: NewDocumentOptionsResolver;
        productionUrl?: AsyncComposableOption<string, ResolveProductionUrlContext>;
        singletons?: UnresolvedSingletonDefinition[] | SingletonsResolver;
        unstable_comments?: {
            enabled:
                | boolean
                | ((context: DocumentCommentsEnabledContext) => boolean);
        };
        unstable_languageFilter?: DocumentLanguageFilterResolver;
    }
    Index

    Properties

    askToEdit?: {
        enabled:
            | boolean
            | ((context: DocumentAskToEditEnabledContext) => boolean);
    }

    Configuration for the "Ask to edit" button that appears when a user lacks edit permissions on a document.

    Type declaration

    • enabled: boolean | ((context: DocumentAskToEditEnabledContext) => boolean)

      Whether the "Ask to edit" button is enabled. Defaults to true.

      Can be a boolean or a function that receives a context object and returns a boolean. When set to false, the "Ask to edit" button will be hidden but the document will still be read-only for users without edit permissions.

    drafts?: { enabled?: boolean }

    Type declaration

    • Optionalenabled?: boolean

      Whether the workspace provides the draft model for interacting with documents.

      When switched off, documents may only be edited:

      • Inside a release.
      • Outside a release if they support live-edit.
    newDocumentOptions?: NewDocumentOptionsResolver

    The singleton configuration, surfaced at the document.singletons configuration path.

    Registering a singleton over a schema type removes that type's plain "create new" initial value template and hides the type from the Structure Tool's default document type lists, so editors can no longer create ordinary documents of that type. If the schema type is also used for ordinary documents (for example, fixed "Spring" and "Summer" campaigns alongside regular campaigns), set allowNonSingletonDocuments: true on the singleton definition to keep ordinary documents creatable. See SingletonDefinition.allowNonSingletonDocuments.

    If a singleton's id, documentId, and schemaType properties are identical, it can simply be provided as a single string. Studio will expand it to a full SingletonDefinition at runtime.

    Alternatively, a resolver function may be provided.

    document: {
    singletons: [
    // `settings` is only used for this one document.
    'settings',
    // Editors can still create ordinary `campaign` documents.
    {documentId: 'spring', schemaType: 'campaign', allowNonSingletonDocuments: true},
    ],
    }
    unstable_comments?: {
        enabled:
            | boolean
            | ((context: DocumentCommentsEnabledContext) => boolean);
    }

    Use comments instead

    unstable_languageFilter?: DocumentLanguageFilterResolver