Sanity Library Reference Docs
    Preparing search index...

    Interface AssetSource

    interface AssetSource {
        component: ComponentType<AssetSourceComponentProps>;
        i18nKey?: string;
        icon?: ComponentType;
        name: string;
        openInSource?: (asset: Asset) => AssetSourceOpenInSourceResult;
        title?: string;
        Uploader?: AssetSourceUploaderClass;
        uploadMode?: "component" | "picker";
    }
    Index

    Properties

    component: ComponentType<AssetSourceComponentProps>
    i18nKey?: string
    icon?: ComponentType
    name: string
    openInSource?: (asset: Asset) => AssetSourceOpenInSourceResult

    Resolve how to open an asset in its original source.

    This function is called for each AssetSource when determining if "Open in Source" should be available. The plugin should check asset.source.name to determine if it can handle this asset.

    Return values:

    • { type: 'url', url: string } - Open the URL (in new window by default)
    • { type: 'component' } - Render the asset source component with action='openInSource'
    • false or undefined - This plugin cannot handle this asset
    title?: string

    provide i18nKey instead

    uploadMode?: "component" | "picker"

    Specifies how uploads should be initiated for this source.

    • 'picker' (default): The studio opens a native file picker first, then passes the selected files to the source via the uploader prop. Progress is tracked via the uploader and shown in the studio UI.

    • 'component': The studio renders the source component directly with action: 'upload'. The source provides its own UI for selecting and uploading files, and tracks progress internally. When complete, the source calls onSelect with the uploaded assets.