Sanity Library Reference Docs
    Preparing search index...

    Type Alias CreateVariantActionBeta

    CreateVariantAction: {
        actionType: "sanity.action.document.variant.create";
        bundleId?: "drafts" | string & {};
        publishedId: string;
        variantId: string;
    } & (
        | {
            baseId?: never;
            document: SanityDocumentStub;
            ifBaseRevisionId?: never;
        }
        | { baseId: string; document?: never; ifBaseRevisionId?: string }
    )

    Creates a variant of a document, either by supplying the full document content, or the base ID of a document to copy.

    Type declaration

    • actionType: "sanity.action.document.variant.create"
    • OptionalbundleId?: "drafts" | string & {}

      Source bundle: 'drafts', or a release id.

      Defaults to the published bundle.

    • publishedId: string

      ID of the document group to create a variant in. Must be a published document ID, without a drafts. or versions. prefix.

    • variantId: string

      Name of the variant definition this document belongs to, as in _.variants.{variantName}. Must be a bare name, not a full document ID.

    • { baseId?: never; document: SanityDocumentStub; ifBaseRevisionId?: never }
      • OptionalbaseId?: never
      • document: SanityDocumentStub

        The full document content. Requires a _type property.

      • OptionalifBaseRevisionId?: never
    • { baseId: string; document?: never; ifBaseRevisionId?: string }
      • baseId: string

        ID of an existing document to copy the content from.

      • Optionaldocument?: never
      • OptionalifBaseRevisionId?: string

        When set, the action fails unless the current revision of the base document matches this value.