Props

runtime
Runtime
required
A Makeswift runtime.
siteVersion
SiteVersion
required
Determines which version of the site to render. If null is passed, then the published site content will be rendered.
children
React.Node
The children components to render.
locale
string

A valid locale string (ex. "en-US").

This is required if your site supports more than one locale.

Example

The following example shows how the <ReactRuntimeProvider> is used to implement the <MakeswiftProvider> client component as outlined in step 9 of the App Router Installation guide. The <MakeswiftProvider> is subsequently utilized in the App Router’s root layout.
"use client";

import { runtime } from "@/makeswift/runtime";
import { type SiteVersion } from "@makeswift/runtime/next";
import {
  ReactRuntimeProvider,
  RootStyleRegistry,
} from "@makeswift/runtime/next";
import "@/makeswift/components";

export function MakeswiftProvider({
  children,
  siteVersion,
}: {
  children: React.ReactNode;
  siteVersion: SiteVersion | null;
}) {
  return (
    <ReactRuntimeProvider siteVersion={siteVersion} runtime={runtime}>
      <RootStyleRegistry>{children}</RootStyleRegistry>
    </ReactRuntimeProvider>
  );
}

Changelog

VersionChanges
v0.25.0Replace the previewMode boolean prop with siteVersion