Sanity Library Reference Docs
    Preparing search index...

    Interface SanityImageObjectAlpha

    Image value accepted by next-sanity/image. Matches SanityImageLike from @sanity/image-url (the shapes sanity typegen generates, including an image whose asset has not been uploaded yet) and keeps the fields those queries actually select: alt, a document _id, and asset.metadata.lqip.

    interface SanityImageObject {
        _id?: string | null;
        _key?: string | null;
        _type?: string;
        alt?: string | null;
        asset?:
            | {
                _id?: string
                | null;
                _ref?: string | null;
                _type?: string;
                _weak?: boolean | null;
                metadata?: { lqip?: string | null } | null;
                url?: string | null;
            }
            | null;
        crop?: | {
            _type?: string;
            bottom?: number
            | null;
            left?: number | null;
            right?: number | null;
            top?: number | null;
        }
        | null;
        hotspot?: | {
            _type?: string;
            height?: number
            | null;
            width?: number | null;
            x?: number | null;
            y?: number | null;
        }
        | null;
        media?: unknown;
    }
    Index

    Properties

    _id?: string | null

    Present when the value is an image document rather than a field. Ignored when asset is set.

    _key?: string | null
    _type?: string
    alt?: string | null
    asset?:
        | {
            _id?: string
            | null;
            _ref?: string | null;
            _type?: string;
            _weak?: boolean | null;
            metadata?: { lqip?: string | null } | null;
            url?: string | null;
        }
        | null

    Type declaration

    • {
          _id?: string | null;
          _ref?: string | null;
          _type?: string;
          _weak?: boolean | null;
          metadata?: { lqip?: string | null } | null;
          url?: string | null;
      }
      • Optional_id?: string | null

        Set when the query dereferences the asset, e.g. asset->{_id}

      • Optional_ref?: string | null

        Set when the query returns the reference as-is, e.g. asset

      • Optional_type?: string
      • Optional_weak?: boolean | null
      • Optionalmetadata?: { lqip?: string | null } | null

        asset->metadata.lqip, used by placeholder="blur"

      • Optionalurl?: string | null

        Set when the query dereferences the asset, e.g. asset->{url}

    • null
    crop?:
        | {
            _type?: string;
            bottom?: number
            | null;
            left?: number | null;
            right?: number | null;
            top?: number | null;
        }
        | null

    The crop set in the Studio, applied to the image URL as a rect param

    hotspot?:
        | {
            _type?: string;
            height?: number
            | null;
            width?: number | null;
            x?: number | null;
            y?: number | null;
        }
        | null

    The hotspot set in the Studio. When the requested dimensions change the aspect ratio, the crop region is positioned around the hotspot.

    media?: unknown