docs/solutions/documentation/2026-04-01-large-interactive-docs-examples-should-use-custom-routes-not-componentpreview.md
ComponentPreviewComponentPreview is fine for normal examples. It is the wrong surface for a
huge interactive page with its own controls, long scroll area, and expensive
editor mount.
The Huge Document example worked, but the preview shell made it look busted: it introduced extra loading time, nested scrolling, and hid the controls that were supposed to be the main point of the example.
Loading... state.Tweaking the example inside the preview was the wrong fight. Removing
autoFocus, adjusting the editor, or shuffling internal layout only changed
the symptoms. The preview shell still owned the scroll box and loading flow.
Render heavy examples as custom docs routes under app/(app)/docs/examples/*
and wrap them with DocContent, just like
server-side/page.tsx.
For Huge Document, the fix was:
DocContent.<ComponentPreview />.The custom route owns the full page layout. There is no nested preview frame, no preview-loading shell, and no second scroll container fighting the example.
That keeps the controls at the top where they belong and lets the example act like a real docs page instead of an embedded demo.
ComponentPreview for lightweight examples.