Skip to content

Canvas setup

.canvas/setup.tsx is the canvas's app shell.

It is optional. When it exists, its default export wraps every card, and everything it imports loads first. Put in it what your app's shell provides.

// .canvas/setup.tsx
import type { ReactNode } from "react";
import "../src/styles/global.css"; // global CSS (and fonts imported there)

export default function CanvasSetup({ children }: { children: ReactNode }) {
  return (
    <ThemeProvider>
      <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
    </ThemeProvider>
  );
}

What to include

  • Global CSS: import the same stylesheet your app imports.
  • Fonts: load them where the canvas sees them. See Fonts.
  • Providers: theme, router context, React Query, i18n: whatever a component reads from context.
  • Data and auth: mock the data components fetch and provide a fake signed-in user, so they render something real instead of a loading or empty state.