Sanity Library Reference Docs
    Preparing search index...

    Interface ReferenceBaseOptions

    BaseOptions applies to all type options.

    It can be extended by interface declaration merging in plugins to provide generic options to all types and fields.

    interface ReferenceBaseOptions {
        canvasApp?: CanvasAppOptions;
        creationTypeFilter?: ReferenceTypeFilter;
        disableNew?: boolean;
        sanityCreate?: SanityCreateOptions;
    }

    Hierarchy (View Summary)

    Index

    Properties

    canvasApp?: CanvasAppOptions
    creationTypeFilter?: ReferenceTypeFilter

    Callback function to dynamically filter which document types can be created from this reference field based on the current document state.

    This allows you to conditionally restrict the types available in the "Create new" dropdown based on other field values in the document.

    Important: This only affects document creation, not which existing documents appear in search results. To filter search results, use the filter option instead.

    Contains the current document, parent value, and field path

    Array of all types configured in the reference field's to property

    Array of type options that should be available for creation. Return the original toTypes array to allow all types, a filtered subset to restrict available types, or an empty array [] to hide the "Create new" button entirely.

    disableNew?: boolean

    When true, hides the "Create new" button in the reference input, preventing users from creating new documents from this field.

    For more granular control (e.g., allowing creation of only specific types, or conditionally hiding the button based on document state), use the creationTypeFilter option instead.

    sanityCreate?: SanityCreateOptions