References 3.0.0-alpha

🤔 Something feels wrong with the reference? Let us know in the ongoing Vue 3 Kit RFC!

Configuration

This is the shape of the object that the createPrismic function expects you to provide. Only the endpoint option is mandatory.

interface PrismicPluginOptions {
    endpoint: string;
    apiOptions?: ApiOptions;

    linkResolver?: LinkResolver;
    htmlSerializer?: HtmlSerializer<string>;

    client?: boolean | ClientOptions;
    dom?: boolean | DOMOptions;
    components?: boolean | ComponentsOptions;
}
const prismic = createPrismic({
    endpoint: "",
    apiOptions: {},

    linkResolver: () => "/",
    htmlSerializer: () => null,

    client: {},
    dom: {},
    components: {},
});
KeyTypeRequiredDefaultDescription
endpointstringYesYour Prismic repository API endpoint
apiOptionsApiOptionsNo{}Additional options sent to Prismic API when initing the client, see Prismic documentation.
linkResolverLinkResolverNo() => "/"A custom link resolver function to use
htmlSerializerHtmlSerializer<string>No() => null (rely on default serialization for everything)A custom HTML serializer function to use
clientClientOptionsNo{} (same as true, activated)More information on the Client kit page
domDOMOptionsNo{} (same as true, activated)More information on the DOM kit page
componentsComponentsOptionsNo{} (same as true, activated)More information on the Components kit page

Exposed Interface

Core

These methods and properties are always available on the exposed interface:

Methods or propertiesTypeDescription
endpointstringProvided API endpoint
apiOptionsApiOptionsProvided API options or the default ones
linkResolver()LinkResolverProvided link resolver or the default one
htmlSerializer()HtmlSerializer<string>Provided HTML Serializer or the default one

Kits

Kits may expose additional methods or properties when activated. Here's an overview of them:

KitExposed methods and propertiesMore information
Clientclient, previewCookie, PredicatesClient kit page
DOMasHtml(), asText(), asLink(), asDate()DOM kit page
ComponentsComponents kit page

Kits exposed methods and properties aren't nested. Access them directly at the root of the Prismic object.

e.g. this.$prismic.client or const { client } = usePrismic()

Edit this page on GitHub Updated at Thu, Aug 12, 2021